Error while using Docx.Editor.Assign

Questions and answers on how to use DOCXReadWrite
Post Reply
eteoklis
Posts: 31
Joined: Wed Feb 03, 2021 10:42 am

Error while using Docx.Editor.Assign

Post by eteoklis »

Hello

In the last few versions we have a big problem

When we try to Assign a document to another we get an exception error

TmplDOCX := TDOCXReadWriteVcl.Create(Nil);
TmplDOCX.Editor.Clear; // == open
TmplDOCX.Clear; // == open
TmplDOCX.LoadFromFile(TmplFile);

DetailDOCX := TDOCXReadWriteVcl.Create(Nil);
DetailDOCX.Editor.Assign(TmplDOCX.Editor); <<----- Exception.

Not all the time. It depends on the type of document we load in TmplDOCX.
After following your code a little we fount that in AXWLogEditor.pas
and in AssignBookmarks procedure the value of the sSrc.LastPara comes sometimes as nil thus the exception.

This is a major issue for us and we would appreciate a fast fix.

Usually we load and try to assign documents with many tables, formatted text etc but i have not been able to determine the reason for this as the error occurs in different documents and in different locations (some clipping of text was involved)

Please inform us if you want a sample doc.

Thanks in advance
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Error while using Docx.Editor.Assign

Post by larsa »

Hello

Yes, please send me a file with this problem.
Lars Arvidsson, Axolot Data
eteoklis
Posts: 31
Joined: Wed Feb 03, 2021 10:42 am

Re: Error while using Docx.Editor.Assign

Post by eteoklis »

Hello there

Well i found out that the problem was an image that was saved as a document.!!!!
I have send you in your private mail a sample.(if you del the image all runs ok).

Also i stumbled in another issue (is demonstrated in the same sample)

When saving as a PDF we have the following issue (the problem exists in the preview also).
If a cell of a table continues in the next page the outer right border of the row disappears.
Also if this is the last row the bottom line disappears also.

We have found a way to circumvent the problem by adding an invisible column on the right and an invisible bottom row but this can not be a lasting fix.

thanks in advance. Keep up the good work.
Post Reply