We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue in excel cells properties

Hi,

I am using aspose cells V 4.8.1.11
I need to set few cells properties for excel file.
After setting up cells properties, if i see print preview in office 2007, i am seeing junk data.
Herewith i have attached native excel file, aspose normalized excel file (you should save this file and see print preview) and screen shot of preview.

Code snippet:
Dim oExcelBook As Workbook = New Workbook
oExcelBook.Open(strOutPath)
For inti = 0 To oExcelBook.Worksheets.Count - 1
Dim oExcelSheet As Worksheet = oExcelBook.Worksheets(inti)
oExcelSheet.PageSetup.Orientation = PageOrientationType.Landscape
oExcelSheet.PageSetup.FitToPagesTall = 1
oExcelSheet.PageSetup.FitToPagesWide = 1
oExcelSheet.PageSetup.Zoom = 100
Next
oExcelBook.Save(strOutPath)

Regards,
Karthik

Hi,

karthik.net2008:
After setting up cells properties, if i see print preview in office 2007, i am seeing junk data.


I don’t see any junk data at all when I used your code with your template file and saved the file with latest version.

karthik.net2008:

Herewith i have attached native excel file, aspose normalized excel file (you should save this file and see print preview) and screen shot of preview.


I have saved both native and aspose normalized exce files using your code and the resultant file is fine, I don’t see any junk data same to your attached screenshot when taking the preview in MS Excel. It looks that your attached screenshot is not the result of this process. I think your attached screenshot is of some other file i.e. “KEY00148286.nor.XLS”. Could you check it and confirm us.

For your code snippet:

Code snippet:
Dim oExcelBook As Workbook = New Workbook
oExcelBook.Open(strOutPath)
For inti = 0 To oExcelBook.Worksheets.Count - 1
Dim oExcelSheet As Worksheet = oExcelBook.Worksheets(inti)
oExcelSheet.PageSetup.Orientation = PageOrientationType.Landscape
oExcelSheet.PageSetup.FitToPagesTall = 1
oExcelSheet.PageSetup.FitToPagesWide = 1
oExcelSheet.PageSetup.Zoom = 100

//Note: Either use PageSetup.FitToPagesTall/FitToPagesWide or PageSetup.Zoom as the latter would take effect.
Next
oExcelBook.Save(strOutPath)


Thank you.