回复 1楼hptj的帖子
demo运行了,和您预期的一样,存在点误差。 我需要咨询一下产品团队,请您稍等2天。
我把核心代码摘录出来了:
- using (Graphics g = fps.CreateGraphics())
- {
- SheetView sv = fps.ActiveSheet;
- PrintInfo pi = fps.ActiveSheet.PrintInfo;
- //百分之一英寸为单位
- pi.PaperSize = new PaperSize("A4", 827, 1169);
- pi.ShowColor = true;
- pi.ShowColumnHeader = PrintHeader.Hide;
- pi.ShowRowHeader = PrintHeader.Hide;
- //A4纸的像素高度为1056
- float a4Height = (float)Math.Round((double)(pi.PaperSize.Height / 100 * g.DpiY));
- //三行总的像素高度为1076
- sv.Cells[0, 0].Text = "haha";
- sv.Rows[0].Height = 1036;
- sv.Cells[1, 0].Text = "haha";
- sv.Cells[2, 0].Text = "haha";
- float rowHeight = sv.Rows[0].Height + sv.Rows[1].Height + sv.Rows[2].Height;
- }
复制代码 |