回复 4楼study1990的帖子
您说的情况,我写代码验证了,情况属实。
可选方案有2个:
1 默认不做处理,导出的PDF边框粗一些
2 如下修改为1个pixel,但是会存在一个缺口(左侧或者右侧)
-
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- this.FpSpread1.OpenExcel(@"C:\a.xls");
- SetBord(1);
- SetEdge();
- this.FpSpread1.SavePdf(@"c:\a.pdf");
- }
- private void SetBord(int border)
- {
- for (int i = 0; i < FpSpread1.Rows.Count; i++)
- {
- for (int j = 0; j < FpSpread1.Columns.Count; j++)
- {
- this.FpSpread1.Cells[i, j].Border.BorderSizeBottom = 1;
- this.FpSpread1.Cells[i, j].Border.BorderSizeLeft = 1;
- this.FpSpread1.Cells[i, j].Border.BorderSizeRight = 1;
- this.FpSpread1.Cells[i, j].Border.BorderSizeTop = 1;
- }
- }
- }
- private void SetEdge(int border = 2)
- {
- for (int i = 0; i < FpSpread1.Rows.Count; i++)
- {
- for (int j = 0; j < FpSpread1.Columns.Count; j++)
- {
- if (i == 0)
- {
- this.FpSpread1.Cells[i, j].Border.BorderSizeTop = 2;
- }
- else if (i == FpSpread1.Rows.Count - 1)
- {
- this.FpSpread1.Cells[i, j].Border.BorderSizeBottom = 2;
- }
- else if (j == 0)
- {
- this.FpSpread1.Cells[i, j].Border.BorderSizeLeft = 2;
- }
- else if (j == FpSpread1.Columns.Count - 1)
- {
-
- this.FpSpread1.Cells[i, j].Border.BorderSizeRight = 2;
- }
- }
- }
- }
复制代码
我这里会给产品团队报一个bug,不过可能修复的周期较长。
非常抱歉 |