Hello,
docx files saved with Word are missing <w:r> .. </w:r> element for empty paragraphs there is only a <w:pPr> element setting font and style and so on inside <w:rPr>, but currently this element is not taken into account durring loading. The result is that empty paragraphs get the default font and style assigned.
Original in Word - the empty paragraphs have a different Font / Size Syle:
After TRichView Save all empty lines share the default font and style.
(TRichView currently saves a <w:r> element also for empty paragraphs is this really required for some word process application?)
I tried to fix this and modified: (I am not sure if this breaks something else?)
TRVDocXReader.LoadParagraph( ... )
procedure LoadParaProps( .. )
begin
... your code ...
// and inserted these lines just before end;
if PropNode <> nil then
begin
// Weber: 23.11.23 empty paragraphs in MSWord DocX doesnt' have a <w:r> element, so we must read the <r:rPr>
// from the paragraph?
ReadCharProperties := [];
LoadCharProperties(FParaCharProperties, FindChildNode(PropNode, 'w:rPr', RVDOCX_XMLNS_W), ReadCharProperties);
// is this correct to set these flags in this location in that case?
FCurParaCharPropSet := FCurParaCharPropSet + ReadCharProperties;
end;
end;
André
DocX loading empty paragraphs wrong font / style assigned
DocX loading empty paragraphs wrong font / style assigned
- Attachments
-
- EmptyParagraph.docx
- Sample Document
- (13.09 KiB) Downloaded 2840 times
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: DocX loading empty paragraphs wrong font / style assigned
What version of TRichView do you use?
Re: DocX loading empty paragraphs wrong font / style assigned
My version info says 21.7.3 installed with the binary from 03.11.2023 (signature timestamp) ?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: DocX loading empty paragraphs wrong font / style assigned
Ok, I'll check this problem at the beginning of the next week.
I already uploaded Delphi12-compatible versions of TRichView, but I still need to update RVMedia ASAP.
I already uploaded Delphi12-compatible versions of TRichView, but I still need to update RVMedia ASAP.
Re: DocX loading empty paragraphs wrong font / style assigned
That is ok - my fix has some other effects if there are true styles assigned in the docx the style must win and the other properties ignoriert.
(it is not so trivial like I thought)
(it is not so trivial like I thought)
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: DocX loading empty paragraphs wrong font / style assigned
Fixed in TRichView v22.1
Re: DocX loading empty paragraphs wrong font / style assigned
Thanks. I will give it a try.
Re: DocX loading empty paragraphs wrong font / style assigned
Is working now. Thank you.