[英]Set Margins In Excel Using Excel Interop VB.Net
Anyone have code to set margins(top,left,right,bottom) using excel interop and vb.net.任何人都有使用 excel interop 和 vb.net 设置边距(上、左、右、下)的代码。 I think it must be part of the worksheet object but maybe the workbook object.
我认为它必须是工作表对象的一部分,但可能是工作簿对象。 Having a tough time finding an example.
很难找到一个例子。 Thanks in advance.
提前致谢。
I found it its part of the worksheet object...我发现它是工作表对象的一部分......
ie IE
xlWorkSheet.PageSetup.TopMargin=0.5 xlWorkSheet.PageSetup.TopMargin=0.5
边距是通过从WorkSheet.PageSetup属性获得的PageSetup对象设置的。
Margin values have to mentioned in points.保证金值必须以点数提及。 Use InchesToPoints(Double) or CentimetersToPoints(Double) to specify the value.
使用 InchesToPoints(Double) 或 CentimetersToPoints(Double) 指定值。
Eg:
Microsoft.Office.Interop.Excel.Application _ExcelAppl = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook _ExcelWorkBook = oXL.Workbooks.Add(missing);
Microsoft.Office.Interop.Excel.Worksheet _ExcelWorkSheet = oWB.ActiveSheet as Microsoft.Office.Interop.Excel.Worksheet;
_ExcelWorkSheet.PageSetup.TopMargin = _ExcelAppl.InchesToPoints(0.25);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.