Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.DOCX / ODT import issues (collection of referenced issues) #290

Open
videosmith opened this issue Oct 23, 2024 · 1 comment
Open

.DOCX / ODT import issues (collection of referenced issues) #290

videosmith opened this issue Oct 23, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@videosmith
Copy link

videosmith commented Oct 23, 2024

When importing a .docx file via QPrompt's External Tools and Applications link to LibreWriter, various decorations are altered or ignored.

Bug Description
One attached document is a LibreWriter file, created by generating random text in an online generator, then copied and pasted into a new Writer document, altered, then saved as a .docx file.
The other document is an .html save of QPrompt's file.

Steps to Reproduce

  1. Create source Writer document and save as .docx format
  2. Load/import into QPrompt
  3. Compare the two documents.

Expected behavior
Overall appearance of the two documents should be similar (allowing for different margins and font sizes).

Paragraph 1: Center Justified honored, bold first sentence honored, font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

Paragraph 2: Right Justified Cantarell Extra bold font honored, italic first sentence honored, text color sentence honored, left margin not honored.

Paragraph 3: Underscored first sentence honored, full justification honored, font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

Paragraph 4: Bold underscored first sentence honored, font size change from rest of document (except for first sentence) honored - affected by the Bold/Underscore decoration? Right justification not honored, font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

Paragraph 5: Italic/underscored first sentence honored, left justified honored, text background color honored (font color must be manually changed to black in Qprompt for readability-a 2 step operation for selecting black - another text color must be selected first), font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

Paragraph 6: Bold/italic/underscored first sentence honored, left justification honored, font changed from Liberation Serif (what Writer used for the Paste operation) to DejaVu Sans. If you select text, change the font in Writer, then change it back (not undo), the font appears to be honored, however margins are not.

All paragraphs have double blank lines after import into QPrompt, instead of single blank lines between each.

Screenshots (optional)
Screenshot_20241022_205628
Screenshot_20241022_205659

Debian 12 Bookworm LXDE AMD64, latest updates

Documents.zip

@Cuperino Cuperino self-assigned this Oct 24, 2024
@Cuperino Cuperino added the enhancement New feature or request label Oct 24, 2024
@Cuperino Cuperino added this to QPrompt Oct 24, 2024
@github-project-automation github-project-automation bot moved this to Uncategorized Issues in QPrompt Oct 24, 2024
@Cuperino Cuperino added this to the 1.x milestone Oct 24, 2024
@Cuperino Cuperino moved this from Uncategorized Issues to File Management in QPrompt Oct 24, 2024
@Cuperino
Copy link
Owner

Thanks for taking the time to prepare this. If I may summarize this categorically, you've found the following behaviors:

  1. Text margins are never respected
  2. The default font in a document is not imported
  3. Right justification is not honored
  4. Default text color continues to be black after a highlight color has been set
  5. All paragraphs have double blank lines after being imported QPrompt

As for how should we act on this data:

  1. Presently margin and padding properties are intentionally filtered out to increase ease of use when pasting contents from a web browser, as web content can have arbitrary margin and padding to aid web design, which is inconvenient in this case.
  • @videosmith Are document margins something you would prefer to be respected? If so, it might be able to discriminate based on header meta-data from the document's source and treat margins coming from native office software different to how web browser contents are treated. The tricky part is finding a right way of dealing with margins that is consistent with all font scales.
    I've created a new issue for this: Respect text margins when importing documents #291
  1. Different software has different default fonts they use as fallback. QPrompt's default is DejaVu, because it's readable and contains glyphs for most languages in the western world.
  • We should be able to detect the default font from the document's metadata and set that to be the default font early in the filtering process. This process however would only work for imported documents, not for text pasted from those same formats, as text being copy-pasted lacks that information in its metadata.
    I've created a new issue for this: Import the default font when loading an office document #292
  1. Right justification not honored... I'll need to look into this. You may have found a bug.
    I've created a new issue for this, tho whether this is actually a bug remains to be confirmed: Right justification is not honored #293
  2. "Automatically changing the default text color after a highlight color has been set" is a quality of life feature implemented by Microsoft Office and other office suites no more than a decade ago. When highlighted text is copied, QPrompt only receives the metadata from the highlight, there's no data on text color coming-in because that is technically still the default. For the color to match, QPrompt would have to match the logic from those programs, which would in turn make it not match the logic of other programs, such as web browsers.
    That however shouldn't be an issue, for we can look at import metadata to tell when the text comes from a document and treat that text differently. Nevertheless, the more complex the logic is, the harder it can be to maintain. For that reason I'd like to keep this logic as simple as possible. The best we can do is try to replicate the behavior from Microsoft Office and LibreOffice. That is, we should treat the text-color metadata as non-existent and store only highlight information, but treat that highlight information as something that sets both color and highlight. I'm honestly not sure of how to program this, but that is how the logic should go to match the office suites.
    This is a duplicate of: Copying highlighted text with automataic color respects automatic color, but perhaps this shouldn't be the case #13
  3. All paragraphs have double blank lines after import into QPrompt.
    This may be a duplicate of: Import adding breakpoints where there should be none #205 and/or of Bullets processed into more bullet points than original breakpoints #179

@Cuperino Cuperino changed the title .docx import issues (may be a duplicate bug report entry) .DOCX / ODT import issues (collection of referenced issues) Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: File Management
Development

No branches or pull requests

2 participants