報告生成器FastReport .NET實踐指南:如何創(chuàng)建WebReport.Report中的ExportParameters事件
報表生成器FastReport .NET是適用于.NET Core 3,ASP.NET,MVC和Windows窗體的全功能報告庫。使用FastReport .NET,您可以創(chuàng)建獨立于應(yīng)用程序的.NET報告。
近日,F(xiàn)astReport .Net升級到v2020.4版,在此版本中,添加了新的條形碼:ITF-14和Deutsce Post Identcode,同時優(yōu)化了多種性能(點擊下方按鈕下載),感興趣的朋友可點擊下方按鈕下載最新版。
Fastreport在線下單立享85折起!趕緊加入購物清單吧!
在FastReport 2020.1中,我們添加了更改導(dǎo)出參數(shù)的功能。因此,您必須在WebReport.Report中預(yù)訂ExportParameters事件。
到目前為止,F(xiàn)astReport.Net庫尚未提供對導(dǎo)出參數(shù)的訪問。或更確切地說,它確實可以,但是僅對某些參數(shù)有效,并且借助于Web報表的各個屬性。所有這些屬性都是堆積在一起的,并且使用intelisense進行操作非常不方便,并且不能滿足用戶的所有需求。因此,決定使用特殊的ExportParameters事件為用戶提供對導(dǎo)出對象的所有屬性的訪問權(quán)限。在事件處理程序中,您可以獲取導(dǎo)出對象并設(shè)置所需的所有屬性。因此,由于先前不可用的屬性,現(xiàn)在可以更精確地配置導(dǎo)出。這是使用新事件的方法:
WebReport.Report.ExportParameters += (sender, e) => { PDFExport export = e.Export as PDFExport; if (export != null) { export.Title = "test"; export.DefaultPage = 2; } };在此示例中,我們僅更改了頁眉和默認頁面。請注意,我們期望在處理時導(dǎo)出PDF,這意味著此代碼將不適用于其他類型的導(dǎo)出。在一個處理程序中,您可以一次為幾種導(dǎo)出類型指定設(shè)置。
public string PdfTitle { get; set; }
public string PdfAuthor { get; set; }
public string PdfSubject { get; set; }
public string PdfKeywords { get; set; }
public string PdfCreator { get; set; }
public string PdfProducer { get; set; }
public string PdfUserPassword { get; set; }
public bool PdfPrintScaling { get; set; }
public string PdfOwnerPassword { get; set; }
public bool PdfAllowModify { get; set; }
public bool PdfAllowCopy { get; set; }
public bool PdfAllowAnnotate { get; set; }
public bool PdfA { get; set; }
public bool PdfShowPrintDialog { get; set; }
public bool PdfImagesOriginalResolution { get; set; }
public bool PdfJpegCompression { get; set; }
public bool PdfAllowPrint { get; set; }
public bool PdfCenterWindow { get; set; }
public bool PdfHideWindowUI { get; set; }
public bool PdfFitWindow { get; set; }
public bool PdfEmbeddingFonts { get; set; }
public bool PdfBackground { get; set; }
public bool PdfInteractiveForms { get; set; }
public bool PdfPrintOptimized { get; set; }
public bool PdfOutline { get; set; }
public bool PdfDisplayDocTitle { get; set; }
public bool PdfHideToolbar { get; set; }
public bool PdfHideMenubar { get; set; }
public bool PdfTextInCurves { get; set; }
我必須說,此屬性列表包括主要和最受歡迎的屬性,但不是全部。許多用戶想要更多。現(xiàn)在,有了新的事件ExportParameters,它們就可以使用全套屬性:
這沒有考慮所有出口的共同屬性。
public bool HideWindowUI { get; set; } - hide user interface;
public bool ShowPrintDialog { get; set; } – show printing dialog;
public bool HideToolbar { get; set; } – hide toolbar in PDF viewer;
public bool HideMenubar { get; set; } – hide menubar in PDF viewer;
public GradientInterpolationPointsEnum GradientInterpolationPoints { get; set; } – gradient interpolation poinrs;
public bool FitWindow { get; set; } – enable window fitting;
public bool CenterWindow { get; set; } – center window;
public bool PrintScaling { get; set; } – show scaling;
public bool Outline { get; set; } – show contents;
public MagnificationFactor DefaultZoom { get; set; } – default zoom;
public int RichTextQuality { get; set; } – RichText quality;
public bool Compressed { get; set; } – compress file;
public bool TransparentImages { get; set; } – transparent image;
public bool DisplayDocTitle { get; set; } – display document title;
public int DefaultPage { get; set; } – default page number;
public byte[] ColorProfile { get; set; } – color profile;
public ExportType ExportMode { get; set; } – export type;
public bool InteractiveForms { get; set; } – enable interactive forms;
public bool IsDigitalSignEnable { get; set; } – enable digital signature;
public bool SaveDigitalSignCertificatePassword { get; set; } – save digital signature certificate password;
public X509Certificate2 DigitalSignCertificate { set; } – digital signature certificate;
public string DigitalSignCertificatePath { get; set; } – digital signature certificate path;
public string DigitalSignCertificatePassword { set; } – ; digital signature certificate password
public string DigitalSignLocation { get; set; } – digital signature location;
public string DigitalSignReason { get; set; } – digital signature reason;
public string DigitalSignContactInfo { get; set; } – digital signature contact info;
public CurvesInterpolationEnum CurvesInterpolation { get; set; } – curves interpolation;
public bool AllowAnnotate { get; set; } – allow annotation;
public bool AllowCopy { get; set; } – allow copying;
public bool AllowModify { get; set; } – allow editing;
public bool AllowPrint { get; set; } – allow print;
public GradientQualityEnum GradientQuality { get; set; } – gradient quality;
public PdfStandard PdfCompliance { get; set; } – PDF standard complience;
public bool EmbeddingFonts { get; set; } – enable embedded fonts;
public bool Background { get; set; } – enable background;
public CurvesInterpolationEnum CurvesInterpolationText { get; set; } – interpolation text curves;
public PdfColorSpace ColorSpace { get; set; } – color space;
public bool ImagesOriginalResolution { get; set; } – use original image resolution;
public bool PrintOptimized { get; set; } – print optimization;
public bool JpegCompression { get; set; } – Jpeg image compression;
public bool TextInCurves { get; set; } – make text in curves;
public string Title { get; set; } – title;
public string UserPassword { get; set; } – user password for encrypted documents;
public int JpegQuality { get; set; } – Jpeg image quality;
public string OwnerPassword { get; set; } – Owner’s password;
public string Producer { get; set; } – Producer;
public bool SvgAsPicture { get; set; } – Display Svg objects as pisctures;
public string Keywords { get; set; } – Keywords;
public string Subject { get; set; } – Subject of the document;
public string Author { get; set; } – Author;
public string Creator { get; set; } – Creator;
FastReport Open Source與FastReport .Net間的功能差異還是非常明顯的,如果您是企業(yè)用戶或是需要更完整的功能,建議您直接購買FastReport .Net,盛夏狂歡,在線下單立享85折起!點擊查看優(yōu)惠價格,或咨詢在線客服了解詳情。