0
我試圖在C#excel文件中使用exportasfixedformat
導出爲pdf文件。但是,轉換爲pdf文件(列和行)紙張大小時,excel文件太大。在將excel文件導出爲pdf文件時,有沒有辦法消除紙張大小?exportasfixedformat無紙張尺寸
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);
但是,這段代碼的輸出會產生互相重疊的字母,這使得它們不可讀。