Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
CustomView print options not saving with workbook
posted

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.Legal
printOptions.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.