Hi Team,
Am using Spire.Doc (6.1 version) in my application. It is working fine in locally. But, its throwing an error "Generic error occurred in GDI++" in azure only. After I analyzed the code and got to know where is the problem. The problem with UpdateTableOfContents() function. When I remove this line, i can generate the word document in azure but Table of Contenst(Index) is not coming in the document,
Below is my code:
private byte[] WriteToDoc()
{
string filePath = "~/Data/xxx.docx";
LoadFromFile(HttpContext.Current.Server.MapPath(filePath));
DocumentSections.Add(new ScopeHeaderSection(this, DocumentTitle, DocumentAuthor));
DocumentSections.Add(new ScopeTableOfContentSection(this));
using (MemoryStream stream = new MemoryStream())
{
SaveToStream(stream, FileFormat.Docx);
Document finalDoc = new Document();
finalDoc.LoadFromStream(stream, FileFormat.Docx);
stream.SetLength(0);
finalDoc.UpdateTableOfContents(); // here , its throws error only in azure.
finalDoc.SaveToStream(stream, FileFormat.Docx);
return stream.ToArray();
}
}
So, Can you help what else i can give to get the Table of Contents without error.
Note: Locally its working fine with UpdateTableOfContents() also.
Please help me out.
Regards,
Vanmathi