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.

Parents
  • 12480
    Offline posted

    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.

    ExcelSavePrintOptions.zip
Reply Children