Click or drag to resize
Pdf Library for .NET

PdfExcelElement Class

Represents an Excel workbook that can be added to a pdf page or template.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalPdfPageElement
    SelectPdf.UniversalPdfElement
      SelectPdf.UniversalPdfExcelElement

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.6
Syntax
public sealed class PdfExcelElement : PdfElement

The PdfExcelElement type exposes the following members.

Constructors
 NameDescription
Public methodPdfExcelElement(Stream)Creates an Excel element from a stream.
Public methodPdfExcelElement(String)Creates an Excel element from a file.
Public methodPdfExcelElement(Single, Single, Stream)Creates an Excel element at (x, y) from a stream.
Public methodPdfExcelElement(Single, Single, String)Creates an Excel element at (x, y) from a file.
Public methodPdfExcelElement(Single, Single, Single, Stream)Creates an Excel element at (x, y) with the specified width from a stream.
Public methodPdfExcelElement(Single, Single, Single, String)Creates an Excel element at (x, y) with the specified width from a file.
Public methodPdfExcelElement(Single, Single, Single, Single, Stream)Creates an Excel element at (x, y) with the specified size from a stream.
Public methodPdfExcelElement(Single, Single, Single, Single, String)Creates an Excel element at (x, y) with the specified size from a file.
Top
Properties
 NameDescription
Public propertyActualText Gets or sets the exact text represented by this element (the structure element's /ActualText entry), used when the drawn glyphs do not map to readable text.
(Inherited from PdfPageElement)
Public propertyAlternateText Gets or sets the alternate text describing this element for assistive technology (the structure element's /Alt entry). Required on figures for PDF/UA conformance.
(Inherited from PdfPageElement)
Public propertyArtifact Gets or sets a value indicating whether this element is an artifact — decorative or layout content that carries no meaning and is excluded from the logical structure (backgrounds, rules, running headers). Takes precedence over TagType.
(Inherited from PdfPageElement)
Public propertyAutoDetectComplexScript Gets or sets whether complex scripts (Arabic, Hebrew, Indic) are detected and shaped even where the workbook does not mark them. Default: false.
Public propertyBackColor Gets or sets the background fill color.
(Inherited from PdfElement)
Public propertyBlending Gets or sets the blending mode.
(Inherited from PdfElement)
Public propertyColorSpace Gets or sets the color space for the pdf element rendering.
(Inherited from PdfElement)
Public propertyConvertBlankPagesGets or sets whether a page with nothing on it is drawn. Default: false.
Public propertyConvertBlankSheetsGets or sets whether a sheet with nothing on it is drawn. Default: false.
Public propertyExternalLinksEnabledRender the workbook's web links as clickable links. Default: true.
Public propertyForeColor Gets or sets the foreground color used for drawing outlines and text.
(Inherited from PdfElement)
Public propertyFormat Gets or sets the format the workbook is read as. Default: Automatic, which takes the format from the file extension, or detects it from the content for a stream.
Public propertyGradient Gets or sets the gradient fill. When set, overrides BackColor for fills.
(Inherited from PdfElement)
Public propertyGridLinesGets or sets whether the gridlines are drawn. Default: Automatic (each sheet's own print setting).
Public propertyHeight Gets or sets the destination height in points. A value of -1 (the default) lets the content flow onto the pages that follow; a fixed height that fits its page shows what fits in it, and a fixed height taller than what is left of the page continues on the pages that follow until that much height has been drawn.
Public propertyInternalLinksEnabledRender the workbook's links to places in itself as internal pdf links. Default: true.
Public propertyLayer Gets or sets the layer (optional content) the element is drawn in: shown and hidden with it in a viewer, printed as the layer says. Null (default) draws it on the page itself, or in the layer of the template it is added to (Layer). The layer must belong to the document the element is added to.
(Inherited from PdfPageElement)
Public propertyLayoutGets or sets how each sheet is scaled onto the pages. Default: Automatic (the sheet's own print scaling).
Public propertyLFN Path of the diagnostic log file written while rendering. When unset, no log is written.
Public propertyLineStyle Gets or sets the line style for outline drawing.
(Inherited from PdfElement)
Public propertyPageRanges Restricts the drawn content to a subset of the rendered pages, e.g. "1", "2-4", "1-3,5,7-". Empty (the default) draws every page.
Public propertyPassword Gets or sets the password of an encrypted workbook. Default: null (it is not encrypted).
Public propertyPdfPagesRectangles Rectangles in the destination document where each rendered page landed, in client-area coordinates of the page that received it. Index 0 is the page drawn on the host page at (X, Y); subsequent entries are the pages that continued on the pages after it, each at X. Populated after the element has been rendered; null beforehand.
Public propertyRotated Gets a value indicating whether a rotation has been applied.
(Inherited from PdfElement)
Public propertyScaled Gets a value indicating whether a scale has been applied.
(Inherited from PdfElement)
Public propertySheetBookmarksGets or sets whether each sheet becomes an entry in the host document's outline. Default: true.
Public propertySheetHeadersAndFootersGets or sets whether the sheets' own printed headers and footers are drawn. Default: true.
Public propertySkewed Gets a value indicating whether a skew has been applied.
(Inherited from PdfElement)
Public propertyTagged Produce tagged, accessible (PDF/UA-style) logical structure from this element's rendered content, taken from the engine's own tagged output and re-mapped onto the host document as the element is stamped.
Public propertyTagType Gets or sets the structure type used to tag this element in a tagged (accessible) document. Ignored unless the document's tagged mode (PdfDocument.Tagged) is enabled. Null (default) leaves the element untagged unless Artifact is set.
(Inherited from PdfPageElement)
Public propertyTranslated Gets a value indicating whether a translation has been applied.
(Inherited from PdfElement)
Public propertyTransparency Gets or sets the transparency level (0 = completely transparent, 100 = completely opaque).
(Inherited from PdfElement)
Public propertyWidth Gets or sets the destination width in points. A value of -1 (the default) fits the element to the available client width minus X.
Public propertyWorksheets Gets or sets the sheets drawn, by name, separated by commas. Empty (the default) draws every visible sheet.
Public propertyXGets or sets the element X position, in client-area coordinates.
Public propertyYGets or sets the element Y position, in client-area coordinates.
Top
Methods
 NameDescription
Public methodRotate Applies a rotation transformation.
(Inherited from PdfElement)
Public methodScale Applies a scale transformation.
(Inherited from PdfElement)
Public methodSkew Applies a skew transformation.
(Inherited from PdfElement)
Public methodTranslate Applies a translation transformation.
(Inherited from PdfElement)
Top
Remarks

The workbook can be given as a file path or as a stream, in any of the formats of ExcelFormat. It is rendered in-process at render time, every sheet laid out on pages the size of the region it is drawn into with no margins of its own (the region is the paper), and the rendered pages are drawn onto the destination page at (X, Y); when the content overflows the available height, it continues on the pages that follow. Hyperlinks stay clickable and each sheet becomes an entry in the outline of the host document (SheetBookmarks).

Coordinates and sizes are expressed in the page's client-area coordinate system - relative to the top-left corner of the writable area inside the page margins.

Example
PdfDocument document = new PdfDocument();
PdfPage page = document.AddPage();
PdfExcelElement sheet = new PdfExcelElement(0, 0, "sales.xlsx");
sheet.Layout = ExcelLayout.FitAllColumnsOnOnePage;
page.Add(sheet);
document.Save("out.pdf");
document.Close();
See Also