【发布时间】:2014-03-04 06:35:28
【问题描述】:
我正在尝试使用 C# excel 文件中的 exportasfixedformat 导出到 pdf 文件。但是excel文件转换为pdf文件(列和行)纸张大小时太大了。将excel文件导出为pdf文件时有没有办法消除纸张大小?
ws.UsedRange.Font.Size = 5;
ws.UsedRange.Font.Name = "Arial Narrow";
ws.UsedRange.Columns.ColumnWidth = 20;
Range RS;
RS = ws.get_Range("A:A", Type.Missing);
RS.EntireColumn.ColumnWidth = 30;
ws.PageSetup.Zoom =false;
ws.PageSetup.FitToPagesWide = 1;
ws.PageSetup.FitToPagesTall = false;
ws.PageSetup.Orientation =
Microsoft.Office.Interop.Excel.XlPageOrientation.xlLandscape;
ws.PageSetup.PaperSize =
Microsoft.Office.Interop.Excel.XlPaperSize.xlPaperLegal;
ws.PageSetup.LeftMargin = 0.5;
ws.PageSetup.RightMargin = 0.5;
ws.PageSetup.TopMargin = 0.5;
ws.PageSetup.BottomMargin = 0.5;
ws.ExportAsFixedFormat(
Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, Filename,
Microsoft.Office.Interop.Excel.XlFixedFormatQuality.xlQualityMinimum,
true, false, 1, ws.UsedRange.Count, false, System.Reflection.Missing.Value);
但是这段代码的输出会产生相互重叠的字母,使它们无法阅读。
【问题讨论】: