C#Excel(2003)互操作 – 边距不对应input值?
我正在使用dotNET C#与Excel 2003进行通信。 我正在尝试更改文档的打印边距 ,但是我input的值不对应于Excel使用的边距值。
xls.PageSetup setup = ws.PageSetup; setup.Orientation = xls.XlPageOrientation.xlLandscape; //Standard margins (Top - Bottom - Left - Right): // 2.5 - 2.5 - 1.9 - 1.9 setup.BottomMargin = 1.0; setup.TopMargin = 1.0; setup.LeftMargin = 1.0; setup.RightMargin = 1.0; //Excel gives me: 0.0 - 0.0 - 0.0 - 0.0 setup.BottomMargin = 20.0; setup.TopMargin = 20.0; setup.LeftMargin = 20.0; setup.RightMargin = 20.0; //Now Excel gives me: 0.7 - 0.7 - 0.7 - 0.7 setup.BottomMargin = 30.0; setup.TopMargin = 30.0; setup.LeftMargin = 30.0; setup.RightMargin = 30.0; //Now Excel gives me: 1.1 - 1.1 - 1.1 - 1.1
正如你所看到的,Excel确实改变了它的利润率,但是它不符合我投入的双倍。有没有一个因素,我失踪了?
非常感谢您的反馈!
边距设置或返回点。 使用InchesToPoints方法或CentimetersToPoints方法来转换从英寸或厘米的测量。
希望这可以帮助
- 迭代通过datagrid行导出到Excel(再次)
- 如何使用Telerik导出到Excel(XLSX)时解释集合?
- 使用c#将公式写入现有excel表单的语法是什么?
- 无法debuggingexcel vsto加载项。 Excel立即打开并closures
- 如何以编程方式访问从剪贴板复制的select地址
- 为什么Excel.WorkSheet.Copy引发具有HRESULT的types为“System.Runtime.InteropServices.COMException”的第一次机会exception的exception:0x800A03EC
- 在openxml中添加样式到Excel
- 从Microsoft Excel自动化Powerpoint数据
- 用c#closuresexcel的问题