We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bookmarks missed while merging DOCX docs

Hi there,
While merging documents we are seeing that -
Case 1:
doclet0 contains Sales
doclet1 contains Sales

then merged doc would have Sales and Sales_0.

That is the behavior we expected but consider the case 2,
Case 2:
doclet0 contains Sales
doclet1 contains sales
then merged doc would have Sales only and sales of doclet2 is totally missed while merging.

We expected merged document would have two bookmarks ‘Sales’ and ‘sales’. Even bookmark is not in XMLs.
Thanks.

Hi Praneeth,

Thanks for your inquiry. Please note that Aspose.Words tries to mimic
the same behavior as MS Word do. MS Word allows only unique names for
bookmarks. If you change the name of a bookmark to a name that already
exists in the document, no error will be given and only the first
bookmark will be stored when you save the document. When you add a
cloned Paragraph into the document, its bookmark will not be stored due
to same name.

It would be great if you please share following detail for investigation purposes.


  • Please attach your input Word documents.
  • Please

    create a standalone/runnable simple Java application that demonstrates the code (Aspose.Words code) you used to generate
    your output document

  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated
    like.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Thanks for looking into this.

Hi Tahir,
We are seeing the same behavior (renaming of bookmarks) with newer version of Aspose.

Attaching 3 input docs:
doc3.docx: 3 bookmarks {Acquisitions, Expenditure, Sales}
doc4.docx: 3 bookmarks {Acquisitions, Expenditure, Sales}
doc6.docx: 3 bookmarks {asposeisaspose, expenditure, sales, acquisitions}

and the output document generated via following code -
UnusualMerge_doc3_4_6.docx, having bookmarks as -
{Acquisitions, Expenditure, Sales, Acquisitions_0, Expenditure_0, Sales_0,
asposeisaspose} and two unknown hidden bookmarks are created during the process - {_GoBack_0, _GoBack_1}.

Document doc3 = new Document(“doc3.docx”);
Document doc4 = new Document(“doc4.docx”);
Document doc6 = new Document(“doc6.docx”);

doc3.appendDocument(doc4, ImportFormatMode.KEEP_SOURCE_FORMATTING);
doc3.appendDocument(doc6, ImportFormatMode.KEEP_SOURCE_FORMATTING);

So, As we said the Aspose is doing bookmarks renaming while merging the documents and more seriously missing few bookmarks if case is differing in subsequent documents. The one more new issue, we saw now - is the creation of hidden bookmarks in the output document.

Thanks for looking.

Hi Praneeth,

Thanks for sharing the detail.

I have tested the scenario and have managed to reproduce the same issues at my side. For the sake of correction, I have logged these problems in our issue tracking system as follow:

WORDSNET-10540 : Document.AppendDocument rename the bookmarks
WORDSNET-10541 : Hidden bookmark are created after joining documents

I have linked this forum thread to the same issues and you will be notified via this forum thread once these issues are resolved. We apologize for your inconvenience.

Thanks Tahir for looking into this.

As the few bookmarks in different cases {expenditure, sales, acquisitions}, in the subsequent doc6.docx part, are also missed while appending the documents, could you please look into that or log it as a issue?


Hi Praneeth,

Thanks for your inquiry. Could you please share some detail about missing bookmarks issue? I have not found this issue in final output document. The bookmarks asposeisaspose, expenditure, sales and acquisitions exist in output document. I have attached the output document with this post for your kind reference.

Hi Tahir,
Yes that’s correct but the bookmarks present are not the ones belonging to doc6.docx, i.e; {expenditure, sales, acquisitions}, these are {Expenditure, Sales, Acquisitions} which are all exists in doc3.docx part in the output document.

I assumed that since Aspose is renaming the bookmarks while merging, so 10 bookmarks should be present in any form, i.e;{Acquisitions, Expenditure, Sales, Acquisitions_0, Expenditure_0, Sales_0, asposeisaspose, expenditure, sales, acquisitions}
OR
{Acquisitions, Expenditure, Sales, Acquisitions_0, Expenditure_0, Sales_0,
asposeisaspose, expenditure_1, sales_1, acquisitions_1}, but clearly only 7 are present.

This is the reason for our reasoning behind 3 bookmarks being missed. Hope I’m making sense.

Thanks.

PS: Our main issue is not with renaming of bookmarks (we actually desire the renaming functionality, at least for now) but bookmarks being missed if are in different case in subsequent documents and the hidden bookmarks being created, while appending.

Hi Praneeth,

Thank you for the additional information.

It
is by MS WORD design that a Word document must have unique names for
bookmarks. You can not insert two bookmarks with the same names. I
think, in your case, you can simply try renaming bookmarks before appending documents.

We will update you via this forum thread once these issues are resolved. We apologize for your inconvenience.

Hi Tahir,
That’s fine, I understand your point. My point is behavior should be the same in all cases which is not the case.

In one case Aspose is renaming the bookmarks and in another case it is missing certain specific bookmarks which are in different cases. So, our point is something is wrong at the time of appending or scanning the bookmarks, as the behavior is not consistent.

Thanks for looking into this.

Hi Praneeth,

Thanks for your inquiry. You are facing this incorrect behavior due to the bugs which were logged in our issue tracking system. We will update you via this forum thread once these issues are resolved.

The issues you have found earlier (filed as WORDSNET-10540;WORDSNET-10541) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.