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

Free Support Forum - aspose.com

Margins not setting

Hi:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I trying to set the left and right margins in a spread sheet to .05 but when I look at the margins in excel they are different?

I am using the code below:

pWorksheet.PageSetup.PaperSize = PaperSizeType.PaperLetter;

pWorksheet.PageSetup.Orientation = PageOrientationType.Landscape;

pWorksheet.PageSetup.LeftMargin = .25;

pWorksheet.PageSetup.RightMargin = .25;

// change the top margin to be .5 per request

// JNS 6/14/2010

pWorksheet.PageSetup.TopMargin = .5;

// This will automatically scale the work sheet to fit the page when printing

pWorksheet.PageSetup.FitToPagesWide = 1;

Can you explain why the margins are showing in excel for left and right 0.0981

Thanks

Neil

Hi,

Could you post your input and output files here. We will check your issue soon.

Which version of the product you are using?

Thank you.

The version is 4.8.0.0

Runtime 2.0.50727

Could you explain what you mean about input and output? The system generates the spreadsheet from a database using your API.

Hi,

Ok, I found your problem. Please change your code as following, it will work fine for your requirement:

pWorksheet.PageSetup.PaperSize
= PaperSizeType.PaperLetter;<o:p></o:p>

pWorksheet.PageSetup.Orientation = PageOrientationType.Landscape;

pWorksheet.PageSetup.LeftMarginInch = .25;

pWorksheet.PageSetup.RightMarginInch = .25;

// change the top margin to be .5 per request

// JNS 6/14/2010

pWorksheet.PageSetup.TopMarginInch = .5;

// This will automatically scale the work sheet to fit the page when printing

pWorksheet.PageSetup.FitToPagesWide = 1;




Thank you.