I am using Crystal to export a report to excel. Then I'm trying to use the Infragistics.Excel classes to change the print options in the excel file but the changes I make are not being saved. I am using Infragistics2.Excel.v10.3. Here is my code.
Dim workbook As Infragistics.Excel.Workbook = Infragistics.Excel.Workbook.Load(excelFilePath)Dim worksheet As Infragistics.Excel.Worksheet = workbook.Worksheets(0)Dim customView As Infragistics.Excel.CustomView = workbook.CustomViews.Add("CustomSettings", True, True)Dim printOptions As Infragistics.Excel.PrintOptions = customView.GetPrintOptions(worksheet)printOptions.PaperSize = Infragistics.Excel.PaperSize.LegalprintOptions.Footer = "&RPage &P of &N"customView.Apply()workbook.Save(excelFilePath)
After the above code is executed I open the Excel file and none of the print options I changed have been saved. Can you tell me what I am doing wrong?
Thank you.
Hi Matt,
It doesn't look like you're doing anything wrong in that code. I wrote a quick sample based on it and I wasn't able to reproduce the issue. The Excel file seemed to retain the settings. Can you send over a sample that reproduces the issue? (Either modify mine or send over your own).
Please let me know if you have any questions.
Thanks Mike. I think there is something about the excel file that Crystal Reports is generating that is preventing me from saving the print options. I can create an excel file manually and get the print options to save so I know that is working.
Thanks for your time.
Matt