Page 1 of 1

Possible Bug

Posted: Thu Jan 06, 2022 10:16 am
by Vinski
Hello!

I think I might have found a bug.
If I add a new paragraph with
DOCX.Editor.AppendPara
and add no text to this paragraph, the program crashes, when it tries to get a preview going.
Saving the document to a file works just fine.

Example:
DOCX:=TDOCXReadWriteVcl.Create(Nil);
DOCX.Editor.Paras.AppendPara;
DOCX.SaveToFile('C:\Users\Praktikant\Desktop\test.docx');
TfrmPreview.Create(Self).Execute(DOCX.Editor);
DOCX.Free;

This code will save the file just fine, but crash, when trying to show a preview it crashes.
Adding
DOCX.Editor.Paras.Last.AppendPlainText('Example');
before the preview fixes the problem.
Is this intentional?
If so, why?

Re: Possible Bug

Posted: Mon Jan 10, 2022 8:53 am
by larsa
Hello

It's intentional. Using AddPara can be more efficient when building documents as the paragraph content don't have to be plain text, it can be tables, tabs, pictures etc.