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

Free Support Forum - aspose.com

Range.Replace and long strings causing exception

Hi


I’m having an issue when using Range.Replace to replace text in a Word Template. If the replacement string doesn’t contain any line breaks and string spans multiple pages the Save as PDF failes with and exception:
System.InvalidOperationException: Stack empty.
at System.Collections.Stack.Pop()

Is there any way around this? Do I need to insert a line break if there is none?

Regards,
Oskar

Hi Oskar,


To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,

The Word file that I’m trying to save as PDF is attached in the following solution.

We’re using a Word Template and fill it with data. The file is then saved as a PDF file to a MemoryStream. I’ve added code that adds a Newline character each approx 180 characters and it seems to work. Not sure if that will work in all cases though.
So we need something more solid.

Regards,
Oskar

Hi Oskar,


Thanks for the additional information. While using the latest version of Aspose.Words i.e. 16.1.0, we managed to reproduce this issue on our end during saving your “1adb02dd-a7f5-47fd-bb61-cfaf2cb26dd9.docx” to PDF. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-13274. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Hi again


Any news on this problem?

Regards,
Oskar

Hi Oskar,


Thanks for your inquiry. Unfortunately, this issue is not resolved yet. Currently, this issue is pending for analysis and is in the queue. We will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

Hi


Any news on when this will be fixed? Approx. date?

Regards,
Oskar

Hi Oskar,


Thanks for your inquiry. The exception is no longer reproducible with latest version of Aspose.Words for .NET i.e 16.2.0. We suggest you please upgrade to the latest version from following link:

Download latest version of Aspose.Words for .NET

Hope, this helps.

Best regards,

Yes, this problem seems to be fixed now.

I’ve got another problem and will create a new post for that.

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


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

Solved. Thanks