- Home
- Forum
- ASP.NET Core - EJ 2
- Replace string in WordDocument with another document, pages are mixed up
Replace string in WordDocument with another document, pages are mixed up
I'm having some problems in replacing a string (TAG) in a word document (TEMPLATE) with another word document that has 3 pages (SUB-DOCUMENT). When the TAG is replaced the pages from the second document are mixed up.
TEMPLATE Document contains a TAG (<![Buildings]!>) that needs to be replaced with a SUB-DOCUMENT
SUB-DOCUMENT is a word document with 3 pages and some tables.
I've attached a sample Console App to reproduce this problem.
In output.docx we can see that the pages from SUB-DOCUMENT are mixed up. page 2 is page 1, page 3 is page 2 and page 1 is page 3.
Also in some cases I see empty paragraphs added to the final document
Thanks
Attachment: ReplaceTagWord_578fbbf1.rar
Hi Pop,
We have reproduced the reported problem “Replace
with another document is not working properly for Word documents” in our
end. We will validate this issue and update you with more details by mid of
this week.
Regards,
Sneha.
Hi,
Thanks for your reply. The problem is related to the structure of the documents. From my research I've found out that if for example the SUB DOCUMENT is a document with 3 pages with just one text on each page is working fine.
Maybe this will help on your investigation.
Thanks
Pop, thank you for providing the details. As mentioned earlier, we will update you with more details by mid of this week.
Pop, we have confirmed that
the reported issue with “Content misplaced in DOCX document while replacing
text with another document” is a defect and we have logged a defect report.
We will include the fix for this defect in our weekly NuGet release, which is
estimated to be available on two weeks. We will let you know once the fix is
included in the weekly release.
The status of this bug can be tracked through the below link:
https://www.syncfusion.com/feedback/50695/content-misplaced-in-docx-document-while-replacing-text-with-another-document
Disclaimer: Inclusion of this
solution in the weekly release may change due to other factors including but
not limited to QA checks and works reprioritization.
Regarding - Also in some cases I see empty paragraphs added to the final
document:
We have ensured that only the empty paragraphs present in the template and
source documents are preserved in the final document. No additional empty
paragraphs are added.
Pop, as promised earlier, we have included the fix for the
reported bug with “Content
misplaced in DOCX document while replacing text with another document” in our latest
weekly NuGet release (v24.2.7).
Root cause of the issue:
The source document contains multiple sections beginning with tables. When
replacing text in a destination document with source document, the found text
owner paragraph index differs for each section's content in the source
document. So, preserving the content of the last section first, followed by
that of the first section, leads to misplaced content.
Please use the below link to download our latest weekly NuGet:
https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core/24.2.7
The status of this bug task can be tracked through the below link:
https://www.syncfusion.com/feedback/50695/content-misplaced-in-docx-document-while-replacing-text-with-another-document
Note: We
will include this fix in our 2024 Volume 1 Main release, which will be
available in the end of March 2024.
Hi, thanks for the update.
Everything is working fine now.
Sorry for the late update, I was in vacation.
Thanks
- 6 Replies
- 3 Participants
-
PI Pop Ioan Mihai
- Feb 2, 2024 02:22 PM UTC
- Feb 28, 2024 12:10 PM UTC