Compile errors after updating to the latest release of ASPOSE


#1

We have some old software written by Aspose internal consultants (!) that we have been running unchanged for several years. Now we want to upgrade to the latest release of Aspose software and are encountering some compile errors due to API changes that have occurred in the past few years.

As no one on our team is an Aspose expert, could someone please help us and provide the updated syntax that we need?

Help is much appreciated.

================================================================

ASPOSE.Email

Errors:

Error BC30516 Overload resolution failed because no accessible ‘Save’ accepts this number of arguments.
Error BC30451 ‘MailMessageSaveOptions’ is not declared. It may be inaccessible due to its protection level.

Line of code:

mailMsg.Save(ms, /* stream
MailMessageSaveType.MHtmlFormat,
MailMessageSaveOptions.WriteHeaderToMht Or
MailMessageSaveOptions.WriteCompleteEmailAddressToMht)

================================================================

ASPOSE.PDF

Errors:

Error BC30002 Type ‘Aspose.Pdf.InteractiveFeatures.XYZExplicitDestination’ is not defined.
Error BC30002 Type ‘Aspose.Pdf.InteractiveFeatures.GoToAction’ is not defined.

Lines of code:

link.Destination = New Aspose.Pdf.InteractiveFeatures.XYZExplicitDestination(prevDst.PageNumber,
prevDst.Left, prevDst.Top, prevDst.Zoom)

pdfOutline.Action = New Aspose.Pdf.InteractiveFeatures.GoToAction(pdfDocument.Pages(TOCPageNo))

pdfOutline.Action = New Aspose.Pdf.InteractiveFeatures.GoToAction(pdfDocument.Pages(Regex.Match(row(“Page”), “\d+”).Value - bookmarksPageAdjust))


#2

@IraD,

I have observed your requirements. For your query concerning to Aspose.Email, I suggest you to please use following sample code on your end.

MhtSaveOptions mhtSaveOptions = new MhtSaveOptions
{
//Specify formatting options required
MhtFormatOptions = MhtFormatOptions.WriteHeader | MhtFormatOptions.WriteCompleteEmailAddress,
};

        eml.Save(new MemoryStream(), mhtSaveOptions);

For further information, you can please refer to this documentation article, Saving Mail Message as MHTML.

For your inquiry concerning to Aspose.PDF, we will share the feedback shortly.


#3

@IraD

With respect to Aspose.PDF for .NET API, we would like to update you that XYZExplicitDestination as well as GoToAction Class has been moved under Aspose.Pdf.Annotations namespace. Please add reference to Aspose.Pdf.Annotations or you can use full qualified name as Aspose.Pdf.Annotations.GoToAction. Moreover, these changes were implemented in Aspose.PDF for .NET 11.6 as mentioned in respective Release Notes.

We hope this will be helpful. In case you still face any issue, please feel free to contact us.


#4

Thank you, Farhan! I made the changes you suggested and my code now compiles.


#5

It is not, however, the end of the story.

In simplest form, our application takes multiple documents of varying types and combines them into a single PDF adding a Table of Contents with one entry for each of the documents being combined. The application uses 4 Aspose DLLs: PDF, Words, Cells and Email.

With the minor changes to syntax for Email and PDF described above (with thanks), we have upgraded the software to use release 18.6 of all the DLLs. The application compiles and executes. However, the output of our application is different!

Keeping Cells, PDF and Email constant at 18.6, we have identified that using different versions of ASPOSE.Words accounts for the differences in our results.

Prior to our changes, the application used ASPOSE.Words 15.1 and we were happy with the results.

Using ASPOSE.Words 16.2, everything remains the same.

Using ASPOSE.Words 16.3, an extra (blank) page appears in the output. We can probably live with this.

But as of ASPOSE.Words 18.2, the Table of Contents is no longer correct, containing only the first entry. This is not usable for us.


#6

@IraD,

I have observed your comments. Can you please share sample project to reproduce issue so that we may further investigate to help you out.


#7

Thank you Adnan. Please see attachments.ASPOSEConsolidation2.zip (1.5 MB)
ReadMe.pdf (278.3 KB)
SampleDocs.zip (30.0 KB)


#8

@IraD,

Thanks for your inquiry. We have executed your shared project and faced following exception message.

Microsoft Excel cannot access the file ‘\fs1\fs1f\Users\Share0\FISTWindows\Spreadsheets\CSR_IFBInstructionsTemplate.xltx’.

You are using Aspose.Cells, Aspose.Email, Aspose.PDF and Aspose.Words in your application. It seems that your query is more related to Aspose.Words. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Please attach the output document that shows the undesired behavior.
  • Please attach the expected output document that shows the desired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

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

PS: To attach these resources, please zip and upload them.


#9

CSR_IFBInstructionsTemplate.zip (6.4 KB)
7-12-2018 2-30-21 PM.jpg (101.3 KB)

Sorry. Please see if the instructions in the attached help.


#10

@IraD,

Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for .NET 18.7 and have not found the shared issue. Please use Aspose.Words for .NET 18.7. We have attached the output PDF with this post for your kind reference. - 20184912 114926_Result.pdf (89.0 KB)


#11

Tahir,

This surprises me very much as we have run this test about 50 times. So I will look again and advise.

Thank you,
Ira


#12

@IraD,

Please upgrade to the latest versions of Aspose products. Please check the attached packages.config file that we used to test the scenario.
packages.zip (271 Bytes)


#13

Yes, this is what I have I the packages.config file.

I have been working on this all morning. I have made about 25 runs looking at things. I still get only one line in the TOC.

I have a little more to look at…


#14

Tahir,

Please read the attached.

IraMoreInfo.pdf (330.9 KB)


#15

@IraD,

Thanks for your inquiry. Please share the following detail here for further testing.

  • After calling addTableOfContents() method, please save your final document to DOCX and share it.
  • Please share your output PDF that shows the undesired behavior.
  • Please share complete detail of your use case.

We will investigate the issue and provide you more information on it.


#16

Tahir,

Attached find a zip of the output directory and also an image that shows how the .docx was preserved.

I am unclear of what you mean by my use case. Do you mean the reason for this application overall? Or something about this execution?

IraAsposeOut.zip (103.2 KB)
7-16-2018 9-20-25 AM.jpg (104.1 KB)


#17

@IraD,

Thanks for sharing the detail.

Please download the application shared by you and test the scenario using latest versions of Aspose products. We have put the “Doc A.docx” and “Doc B.jpg” files in “asposein” folder and tested the scenario. We have not found the TOC issue.

In your case, you are setting custom style for paragraphs. Please make sure that you are calling addCustomBookmark method correctly.

The output document (DOCX) shared by you have paragraph before the image. Its style is “Normal”. It should be “Aspose_Custom_Bookmark_Style”. Please make sure that you are setting it correctly.