Free Support Forum - aspose.com

Issue Extracting BookMark from word document

Hi,

I am working on a code which extracts the bookmark from the word document and that works correctly if all the bookmarks are on first page of the document.
I am not getting all the bookmark that span across multiple pages on the word document. Am I missing something here.
code:
string inputFile = “InputFile.docx”;
Aspose.Words.Document inputDocument = new Aspose.Words.Document(inputFile);
List<Aspose.Words.Bookmark> bookmarks = new List();

for (int i = 0; i < inputDocument.Range.Bookmarks.Count; i++)
{
bookmarks.Add(inputDocument.Range.Bookmarks[i]);
}

The value I am getting for - inputDocument.Range.Bookmarks.Count is not correct when I have a document with bookmark on multiple pages. Please suggest.

Hi Ashish,

Thanks for your inquiry. Yes, you are doing correct. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Thank you for the response. I tried with other document and it was extracting all the bookmark. So could be just that document. Anyway thank you.

Hi,


I am not sure if this is a fluke or something but the result I am getting is not consistent. Earlier same document was not extracting correct bookmark number, later it did gave the correct result.
Similar thing happened today, where I had in consistent result.

I have a document which I am trying to convert to pdf using Aspose Word for .Net. The code is simple, as mentioned in documentation on this website.

Document doc = new Document(MyDir + “Document.doc”);

doc.Save(MyDir + “Document.Doc2PdfSave Out.pdf”);

While executing the above code, first it gave an error, later did not gave an error and again gave an error. Error detail is as listed below. I am not sure what’s going on. The document I am using is company confidential, so I will need to modify before I can attach it here. But just wanted to check possible cause of this with the detail error message and stack trace of the document.save method.

Error -

[ArgumentException: The argument cannot be null or empty string.
Parameter name: value]
   x6c95d9cf46ff5f25.x0d299f323d241756.x48501aec8e48c869(String xbcea506a33cf9111, String xae050273e3024171) +99
   Aspose.Words.Font.set_Name(String value) +21
   x59d6a4fc5007b7a4.x038d2057eb729fcf.get_xc2d4efc42998d87b() +119
   x99ec507695f2d4ff.x42b8c317113a56e4.x12ca3a3e2d5518cd(x038d2057eb729fcf x5906905c888d3d98) +22
   x99ec507695f2d4ff.x42b8c317113a56e4.xe04b5d7c28160175(xcd3694ded987e19d x5906905c888d3d98) +18
   x6a42c37b95e9caa1.xfef22f4f866de8d2.x5e3c9e6ae8d36dd1(xcd3694ded987e19d x5906905c888d3d98) +12
   x59d6a4fc5007b7a4.xcd3694ded987e19d.x7012609bcdb39574(x3adba2572f6b9747 x672ff13faf031f3d) +12
   x59d6a4fc5007b7a4.x6a53cec2ada67e5c.x7012609bcdb39574(x3adba2572f6b9747 x672ff13faf031f3d) +385
   x59d6a4fc5007b7a4.xbf5b03855bcdbdae.x7012609bcdb39574(x3adba2572f6b9747 x672ff13faf031f3d) +107
   x59d6a4fc5007b7a4.xb850ecb8335a2e09.xa246eb87eda7b55d(x3adba2572f6b9747 x672ff13faf031f3d, x398b3bd0acd94b61 xd7e5673853e47af4) +100
   x59d6a4fc5007b7a4.x24007e5c985fb52a.x7012609bcdb39574(x3adba2572f6b9747 x672ff13faf031f3d) +68
   x59d6a4fc5007b7a4.xdcf47a8f1807f37c.x7012609bcdb39574(x3adba2572f6b9747 x672ff13faf031f3d) +376
   x6a42c37b95e9caa1.xfef22f4f866de8d2.xe406325e56f74b46(xdcf47a8f1807f37c x32eaf67d0ee57cb7, xdeb77ea37ad74c56 x1e972e751678e682) +601
   xf989f31a236ff98c.x6c74398bceb133f8.xa2e0b7f7da663553(x8556eed81191af11 x5ac1382edb7bf2c2) +304
   Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c) +163
   Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions) +201
   Aspose.Words.Document.Save(String fileName) +7

Please suggest as  soon as possible as we are close to deciding on the purchase of this product. This would be very critical issue which will decide on the management decision  on purchase 
of this product. 
Hi Ashish,

Thanks for your inquiry. Perhaps, you are using an older version of Aspose.Words. I would suggest you please use the latest version of Aspose.Words i.e. v11.10.0 and let us know how it goes on your side. I hope, this will help.

Moreover, please share sample test documents here for testing. I will investigate the issue on my side and provide you more information.

Thanks Tahir for the suggestion. I tried with the latest version of the aspose word and still I get the same issue. I have attached the sample document for your research. One thing I observed was this word file if tried to convert into pdf using Aspose directly without opening it, gives an error.

When I opened the word file and then closed it, I did not got error. Something is inconsistent here.

Please suggest!

Hi Ashish,


Thanks for sharing the document. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7554 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks Tahir for the update.

Do you have any timeframe that you can provide on how long it's going to take to fix this issue. We are close to buying Aspose for our product and this issue would be a big blocker for us.

Is there any work around or indirect way to code to avoid this for a time being while the issue gets resolved? Normally, how long does it takes for the issue to be resolved and included on the newer version or patch?

Thank you,

Ashish

Hi Ashish,


Thanks for your inquiry. Currently, this issue WORDSNET-7554 is pending for analysis and is in the queue. I am afraid, I can not provide you any reliable estimate at the moment. Once your issue is analyzed, we will then be able to provide you an estimate.

Please use the following code snippet as a workaround.

<span lang=“EN-GB” style=“font-size:10.0pt;font-family:“Courier New”;color:#2B91AF;mso-font-kerning:
0pt;mso-no-proof:yes”>Document<span lang=“EN-GB” style=“font-size:10.0pt;
font-family:“Courier New”;mso-font-kerning:0pt;mso-no-proof:yes”> doc = new Document(MyDir

  • “in.docx”);<o:p></o:p>

MemoryStream stream = new MemoryStream();

doc.Save(stream, SaveFormat.Docx);

doc = new Document(stream);

doc.Save(MyDir + "AsposeOut.pdf", SaveFormat.Pdf);

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


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