delphi TMS FlexCel 导出页面设置

TMS FlexCel 导出页面设置

属性和方法

TFlexCelHtmlExport.HidePrintObjects

property HidePrintObjects: Set of THidePrintObjects

选择哪些类型的对象不应该导出。

导出到HTML默认情况下,不导出页眉和页脚,因为它们在导出到HTML时通常不是你想要的。

THidePrintObjects

枚举定义哪些对象不应打印或导出。

可以同时使用多个选项。例如,要不打印图像和注释,应该指定: THidePrintObjects.Images | THidePrintOption.Comments

unit

FlexCel.Core

  • Images 不要将图像打印或导出。
  • Comments 不要将注释打印或导出。
  • Hyperlynks 不要将超链接打印或导出。
  • Headers 不要将页眉打印或导出。
  • Footers 不要将页脚打印或导出。
  • PageBreaks 不要导出分页符。 此属性仅适用于 html 导出。

TFlexCelPdfExport.PrintRangeLeft

property PrintRangeLeft: Integer

要打印的第一列( 索引从1开始)。

如果PrintRangeLeftPrintRangeTopPrintRangeRightPrintRangeBottom 其中一个为 0,则将自动计算范围。

TFlexCelPdfExport.PrintRangeTop

property PrintRangeTop: Integer

要打印的第一行( 索引从1开始)。

如果PrintRangeLeftPrintRangeTopPrintRangeRightPrintRangeBottom 其中一个为 0,则将自动计算范围。

TFlexCelPdfExport.PrintRangeRight

property PrintRangeRight: Integer

要打印的最后一列( 索引从1开始)。

如果PrintRangeLeftPrintRangeTopPrintRangeRightPrintRangeBottom 其中一个为 0,则将自动计算范围。

TFlexCelPdfExport.PrintRangeBottom

property PrintRangeBottom: Integer

要打印的最后一行( 索引从1开始)。

如果PrintRangeLeftPrintRangeTopPrintRangeRightPrintRangeBottom 其中一个为 0,则将自动计算范围。

TFlexCelPdfExport.PageSize

property PageSize: TPaperDimensions

PDF页面大小。

将其设置为空以使用Excel文件上的纸张大小。

TPaperDimensions.Create

class function Create(const PaperSize: TPaperSize): TPaperDimensions;
class function Create(const aPaperName: string; const aWidth: Double; const aHeight: Double): TPaperDimensions;

创建一个新的TPaperDimensions实例。

参数

PaperSize Excel 标准纸张大小。

aPaperName 标识纸张名称的字符串。

aWidth 宽度(英寸/100)

aHeight 高度(英寸/100)

TPaperSize

预定义的页面大小。

对于打印机特定的页面大小,请参阅TPrinterDriverSettings。打印机特定的页面大小的值可能不在此枚举中。

unit

FlexCel.Core

名称 描述
Undefined 没有定义的。
Letter Letter - 81/2"" x 11""
Lettersmall Letter small - 81/2"" x 11""
Tabloid Tabloid - 11"" x 17""
Ledger Ledger - 17"" x 11""
Legal Legal - 81/2"" x 14""
Statement Statement - 51/2"" x 81/2""
Executive Executive - 71/4"" x 101/2""
A3 A3 - 297mm x 420mm
A4 A4 - 210mm x 297mm
A4small A4 small - 210mm x 297mm
A5 A5 - 148mm x 210mm
B4_JIS B4 (JIS) - 257mm x 364mm
B5_JIS B5 (JIS) - 182mm x 257mm
Folio Folio - 81/2"" x 13""
Quarto Quarto - 215mm x 275mm
s10x14 10x14 - 10"" x 14""
s11x17 11x17 - 11"" x 17""
Note Note - 81/2"" x 11""
Envelope9 Envelope #9 - 37/8"" x 87/8""
Envelope10 Envelope #10 - 41/8"" x 91/2""
Envelope11 Envelope #11 - 41/2"" x 103/8""
Envelope12 Envelope #12 - 43/4"" x 11""
Envelope14 Envelope #14 - 5"" x 111/2""
C C - 17"" x 22""
D D - 22"" x 34""
E E - 34"" x 44""
EnvelopeDL Envelope DL - 110mm x 220mm
EnvelopeC5 Envelope C5 - 162mm x 229mm
EnvelopeC3 Envelope C3 - 324mm x 458mm
EnvelopeC4 Envelope C4 - 229mm x 324mm
EnvelopeC6 Envelope C6 - 114mm x 162mm
EnvelopeC6_C5 Envelope C6/C5 - 114mm x 229mm
B4_ISO B4 (ISO) - 250mm x 353mm
B5_ISO B5 (ISO) - 176mm x 250mm
B6_ISO B6 (ISO) - 125mm x 176mm
EnvelopeItaly Envelope Italy - 110mm x 230mm
EnvelopeMonarch Envelope Monarch - 37/8"" x 71/2""
s63_4Envelope 63/4 Envelope - 35/8"" x 61/2""
USStandardFanfold US Standard Fanfold - 147/8"" x 11""
GermanStdFanfold German Std. Fanfold - 81/2"" x 12""
GermanLegalFanfold German Legal Fanfold - 81/2"" x 13""
B4_ISO_2 B4 (ISO) - 250mm x 353mm
JapanesePostcard Japanese Postcard - 100mm x 148mm
s9x11 9x11 - 9"" x 11""
s10x11 10x11 - 10"" x 11""
s15x11 15x11 - 15"" x 11""
EnvelopeInvite Envelope Invite - 220mm x 220mm
LetterExtra Letter Extra - 91/2"" x 12""
LegalExtra Legal Extra - 91/2"" x 15""
TabloidExtra Tabloid Extra - 1111/16"" x 18""
A4Extra A4 Extra - 235mm x 322mm
LetterTransverse Letter Transverse - 81/2"" x 11""
A4Transverse A4 Transverse - 210mm x 297mm
LetterExtraTransv Letter Extra Transv. - 91/2"" x 12""
SuperA_A4 Super A/A4 - 227mm x 356mm
SuperB_A3 Super B/A3 - 305mm x 487mm
LetterPlus Letter Plus - 812"" x 1211/16""
A4Plus A4 Plus - 210mm x 330mm
A5Transverse A5 Transverse - 148mm x 210mm
B5_JIS_Transverse B5 (JIS) Transverse - 182mm x 257mm
A3Extra A3 Extra - 322mm x 445mm
A5Extra A5 Extra - 174mm x 235mm
B5_ISO_Extra B5 (ISO) Extra - 201mm x 276mm
A2 A2 - 420mm x 594mm
A3Transverse A3 Transverse - 297mm x 420mm
A3ExtraTransverse A3 Extra Transverse - 322mm x 445mm
DblJapanesePostcard Dbl. Japanese Postcard - 200mm x 148mm
A6 A6 - 105mm x 148mm
LetterRotated Letter Rotated - 11"" x 81/2""
A3Rotated A3 Rotated - 420mm x 297mm
A4Rotated A4 Rotated - 297mm x 210mm
A5Rotated A5 Rotated - 210mm x 148mm
B4_JIS_Rotated B4 (JIS) Rotated - 364mm x 257mm
B5_JIS_Rotated B5 (JIS) Rotated - 257mm x 182mm
JapanesePostcardRot Japanese Postcard Rot. - 148mm x 100mm
DblJapPostcardRot Dbl. Jap. Postcard Rot. - 148mm x 200mm
A6Rotated A6 Rotated - 148mm x 105mm
B6_JIS B6 (JIS) - 128mm x 182mm
B6_JIS_Rotated B6 (JIS) Rotated - 182mm x 128mm
s12x11 12x11 - 12"" x 11""

例子

设置纸张大小和导出范围

uses VCL.FlexCel.Core, FlexCel.XlsAdapter, FlexCel.Render;

procedure TForm1.Button23Click(Sender: TObject);
var
  Xls: TXlsFile;
  Pdf: TFlexCelPdfExport;
begin
  //读取Excel文件
  Xls := TXlsFile.Create('C:\Users\Administrator\Desktop\ceshi2.xlsx');
  //关联导出的文档
  Pdf := TFlexCelPdfExport.Create(Xls, True);
  try
    //使用Excel的纸张大小(默认值)
    //Pdf.PageSize := TPaperDimensions.Create('', 0, 0);
    //设置纸张大小为A4横向
    Pdf.PageSize := TPaperDimensions.Create(TPaperSize.A4Rotated);
    //设置导出范围(A2:G20)
    Pdf.PrintRangeLeft := 2;
    Pdf.PrintRangeTop := 2;
    Pdf.PrintRangeRight := 10;
    Pdf.PrintRangeBottom := 20;
    //导出当前活动的工作表到文件
    Pdf.Export('C:\Users\Administrator\Desktop\ceshi.pdf');
  finally
    Pdf.Free;
    Xls.Free;
  end;
end;
posted @ 2022-10-29 11:35  txgh  阅读(162)  评论(0编辑  收藏  举报