Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have code for Generate Excel in c# it works fine in local but show error in server
and also work well for c# 2.0 in server

C#
ExlApp.DisplayAlerts = false;
                WB = ExlApp.Workbooks.Open(EXLPath, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal);
                WB.Activate();
                Microsoft.Office.Interop.Excel.Worksheet WS = (Microsoft.Office.Interop.Excel.Worksheet)WB.ActiveSheet;
                WS.PageSetup.Orientation = Microsoft.Office.Interop.Excel.XlPageOrientation.xlPortrait;
                WS.PageSetup.PaperSize = Microsoft.Office.Interop.Excel.XlPaperSize.xlPaperA4;
                WS.PageSetup.Zoom = false;
                WS.PageSetup.FitToPagesWide = 1;
                WS.PageSetup.FitToPagesTall = false;
                WS.PageSetup.RightMargin = ExlApp.InchesToPoints(0.2);
                WS.PageSetup.LeftMargin = ExlApp.InchesToPoints(0.2);
                WS.PageSetup.TopMargin = ExlApp.InchesToPoints(0);
                WS.PageSetup.BottomMargin = ExlApp.CentimetersToPoints(0.2);


Thanks
Posted
Updated 23-Feb-15 2:19am
v2
Comments
Kornfeld Eliyahu Peter 23-Feb-15 2:52am    
What error?
Dev parmar 23-Feb-15 8:12am    
Unable to set the Orientation property of the PageSetup class

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900