Hi Aslam,
I tried the attached DDL but still facing the same problem.
Remember, I am applying bookmarks to the PDF with using
workbookDesigner.Workbook.SaveOptions.PdfBookmark
After applying the bookmarks to PDF, I converted the workbookDesigner to MemoryStream and returned from a method. When I tried to convert this MemoryStream back to WorkbookDesigner object, it deletes the applied bookmarks.
Sample Code below
public MemorySteam GetPDF()
{
WorkbookDesigner workbookDesigner = new WorkbookDesigner();
workbookDesigner.Open(memStream); //Loads an excel file which already loaded in MemorySteam
//Now applied the bookmarks into it.
PdfBookmarkEntry pdfBookMarks = new PdfBookmarkEntry();
PdfBookmarkEntry bookmarkChild = null;
foreach (Worksheet worksheet in workbookDesigner.Workbook.Worksheets)
{
bookmarkChild = new PdfBookmarkEntry();
bookmarkChild.Text = worksheet.Name;
bookmarkChild.Destination = Cell["A3"];
pdfBookMarks.SubEntry.Add(bookmarkChild);
}
//Add bookmarks
workbookDesigner.Workbook.SaveOptions.PdfBookmark = pdfBookMarks;
//Bookmarks exists till this point in WorkBookDesigner object
MemoryStream stream = workbookDesigner.Workbook.SaveToStream();
}
MemorySteam str = GetPDF();
WorkbookDesigner workbookDesigner = new WorkbookDesigner();
workbookDesigner.Open(str);
//Bookmarks doesnot exist in the WorkBook Designer object anymore
if (workbookDesigner.Workbook.SaveOptions.PdfBookmark != null)
{
//-------------------
//-------------------
}
Regards,
Ankush