{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "spreadsheet-exporting",
  "framework": "winforms",
  "type": "registry:component",
  "component": "Spreadsheet",
  "variant": "exporting",
  "dependencies": [
    "Syncfusion.Spreadsheet.Windows"
  ],
  "description": "Spreadsheet populated from a workbook and exported page by page to PDF using ExcelToPDFConverter with header and footer text.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/winforms/llms.txt",
    "skillPack": "syncfusion/winforms-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/winforms/spreadsheet-exporting.md"
  },
  "files": [
    {
      "target": "src/components/spreadsheet-exporting/spreadsheet.Designer.cs",
      "content": "using System;\nusing System.ComponentModel;\nusing System.Drawing;\nusing System.Windows.Forms;\nusing Syncfusion.Windows.Forms.Spreadsheet;\n\nnamespace SpreadsheetExporting\n{\n    partial class Form1\n    {\n        /// <summary>\n        /// Required designer variable.\n        /// </summary>\n        private IContainer components = null;\n\n        /// <summary>\n        /// Clean up any resources being used.\n        /// </summary>\n        protected override void Dispose(bool disposing)\n        {\n            if (disposing && (components != null))\n            {\n                components.Dispose();\n            }\n            base.Dispose(disposing);\n        }\n\n        #region Windows Form Designer generated code\n\n        /// <summary>\n        /// Required method for Designer support - do not modify\n        /// the contents of this method with the code editor.\n        /// </summary>\n        private void InitializeComponent()\n        {\n            this.components = new System.ComponentModel.Container();\n            this.exportGroupBox = new GroupBox();\n            this.htmlRadioButton = new RadioButton();\n            this.imageRadioButton = new RadioButton();\n            this.pdfRadioButton = new RadioButton();\n            this.exportButton = new Button();\n            this.spreadsheet = new Spreadsheet();\n            this.spreadsheetPanel = new Panel();\n            this.exportGroupBox.SuspendLayout();\n            this.spreadsheetPanel.SuspendLayout();\n            this.SuspendLayout();\n            //\n            // exportGroupBox\n            //\n            this.exportGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\n                         | System.Windows.Forms.AnchorStyles.Right));\n            this.exportGroupBox.Controls.Add(this.htmlRadioButton);\n            this.exportGroupBox.Controls.Add(this.imageRadioButton);\n            this.exportGroupBox.Controls.Add(this.pdfRadioButton);\n            this.exportGroupBox.Controls.Add(this.exportButton);\n            this.exportGroupBox.Font = new System.Drawing.Font(\"Segoe UI\", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.exportGroupBox.Location = new System.Drawing.Point(575, 1);\n            this.exportGroupBox.Name = \"exportGroupBox\";\n            this.exportGroupBox.Size = new System.Drawing.Size(180, 360);\n            this.exportGroupBox.TabIndex = 3;\n            this.exportGroupBox.TabStop = false;\n            this.exportGroupBox.Text = \"Export Options\";\n            //\n            // htmlRadioButton\n            //\n            this.htmlRadioButton.Location = new System.Drawing.Point(10, 35);\n            this.htmlRadioButton.Name = \"htmlRadioButton\";\n            this.htmlRadioButton.Size = new System.Drawing.Size(150, 35);\n            this.htmlRadioButton.TabIndex = 0;\n            this.htmlRadioButton.Text = \"Export to HTML\";\n            //\n            // imageRadioButton\n            //\n            this.imageRadioButton.Location = new System.Drawing.Point(10, 90);\n            this.imageRadioButton.Name = \"imageRadioButton\";\n            this.imageRadioButton.Size = new System.Drawing.Size(150, 35);\n            this.imageRadioButton.TabIndex = 1;\n            this.imageRadioButton.Text = \"Export to Image\";\n            //\n            // pdfRadioButton\n            //\n            this.pdfRadioButton.Checked = true;\n            this.pdfRadioButton.Location = new System.Drawing.Point(10, 150);\n            this.pdfRadioButton.Name = \"pdfRadioButton\";\n            this.pdfRadioButton.Size = new System.Drawing.Size(150, 35);\n            this.pdfRadioButton.TabIndex = 2;\n            this.pdfRadioButton.Text = \"Export to PDF\";\n            //\n            // exportButton\n            //\n            this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.exportButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(165)))), ((int)(((byte)(220)))));\n            this.exportButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\n            this.exportButton.Font = new System.Drawing.Font(\"Segoe UI\", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.exportButton.ForeColor = System.Drawing.Color.White;\n            this.exportButton.Location = new System.Drawing.Point(50, 220);\n            this.exportButton.Name = \"exportButton\";\n            this.exportButton.Size = new System.Drawing.Size(100, 35);\n            this.exportButton.TabIndex = 4;\n            this.exportButton.Text = \"Export\";\n            this.exportButton.UseVisualStyleBackColor = false;\n            this.exportButton.Click += new System.EventHandler(this.exportButton_Click);\n            //\n            // spreadsheet\n            //\n            this.spreadsheet.AllowCellContextMenu = true;\n            this.spreadsheet.AllowExtendRowColumnCount = true;\n            this.spreadsheet.AllowFormulaRangeSelection = true;\n            this.spreadsheet.AllowTabItemContextMenu = true;\n            this.spreadsheet.AllowZooming = true;\n            this.spreadsheet.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\n                         | System.Windows.Forms.AnchorStyles.Left)\n                         | System.Windows.Forms.AnchorStyles.Right)));\n            this.spreadsheet.DefaultColumnCount = 101;\n            this.spreadsheet.DefaultRowCount = 101;\n            this.spreadsheet.FormulaBarVisibility = false;\n            this.spreadsheet.Location = new System.Drawing.Point(0, 0);\n            this.spreadsheet.Name = \"spreadsheet\";\n            this.spreadsheet.Size = new System.Drawing.Size(560, 376);\n            this.spreadsheet.TabIndex = 0;\n            this.spreadsheet.Text = \"spreadsheet\";\n            //\n            // spreadsheetPanel\n            //\n            this.spreadsheetPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\n                         | System.Windows.Forms.AnchorStyles.Left)\n                         | System.Windows.Forms.AnchorStyles.Right)));\n            this.spreadsheetPanel.BackColor = System.Drawing.Color.White;\n            this.spreadsheetPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\n            this.spreadsheetPanel.Controls.Add(this.spreadsheet);\n            this.spreadsheetPanel.ForeColor = System.Drawing.Color.DarkGray;\n            this.spreadsheetPanel.Location = new System.Drawing.Point(10, 0);\n            this.spreadsheetPanel.Name = \"spreadsheetPanel\";\n            this.spreadsheetPanel.Size = new System.Drawing.Size(560, 376);\n            this.spreadsheetPanel.TabIndex = 5;\n            //\n            // Form1\n            //\n            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\n            this.ClientSize = new System.Drawing.Size(793, 403);\n            this.Controls.Add(this.exportGroupBox);\n            this.Controls.Add(this.spreadsheetPanel);\n            this.Font = new System.Drawing.Font(\"Segoe UI\", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.Icon = new System.Drawing.Icon(SpreadsheetExportingDataSource.GetIconPath());\n            this.MinimumSize = new System.Drawing.Size(600, 350);\n            this.Name = \"Form1\";\n            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\n            this.Text = \"Exporting\";\n            this.Load += new System.EventHandler(this.Form1_Load);\n            this.spreadsheetPanel.ResumeLayout(false);\n            this.exportGroupBox.ResumeLayout(false);\n            this.exportGroupBox.PerformLayout();\n            this.ResumeLayout(false);\n\n        }\n\n        #endregion\n    }\n}\n"
    },
    {
      "target": "src/components/spreadsheet-exporting/spreadsheet.cs",
      "content": "using System;\nusing System.Drawing;\nusing System.Drawing.Imaging;\nusing System.Windows.Forms;\nusing Syncfusion.ExcelToPdfConverter;\nusing Syncfusion.Pdf;\nusing Syncfusion.XlsIO;\nusing Syncfusion.XlsIO.Implementation;\nusing Syncfusion.Windows.Forms.Spreadsheet;\n\nnamespace SpreadsheetExporting\n{\n    /// <summary>\n    /// Demonstrates exporting a Syncfusion Spreadsheet to HTML, an image and PDF.\n    /// </summary>\n    public partial class Form1 : Form\n    {\n        private Spreadsheet spreadsheet;\n        private GroupBox exportGroupBox;\n        private RadioButton htmlRadioButton;\n        private RadioButton imageRadioButton;\n        private RadioButton pdfRadioButton;\n        private Button exportButton;\n        private Panel spreadsheetPanel;\n\n        public Form1()\n        {\n            InitializeComponent();\n        }\n\n        /// <summary>\n        /// Exports the spreadsheet using the currently selected export option.\n        /// </summary>\n        private void exportButton_Click(object sender, EventArgs e)\n        {\n            if (this.pdfRadioButton.Checked)\n            {\n                ExportToPDF(this.spreadsheet);\n            }\n            else if (this.htmlRadioButton.Checked)\n            {\n                ExportWorkbookToHTML(this.spreadsheet);\n            }\n            else if (this.imageRadioButton.Checked)\n            {\n                ExportWorksheetToBitmap(this.spreadsheet);\n            }\n        }\n\n        /// <summary>\n        /// Opens the workbook that ships with this sample.\n        /// </summary>\n        private void Form1_Load(object sender, EventArgs e)\n        {\n            string workbookPath = SpreadsheetExportingDataSource.GetWorkbookPath();\n            if (System.IO.File.Exists(workbookPath))\n            {\n                this.spreadsheet.Open(workbookPath);\n            }\n        }\n\n        #region PDF\n\n        /// <summary>\n        /// Converts the workbook into a PDF document.\n        /// </summary>\n        private static void ExportToPDF(Spreadsheet spreadsheetControl)\n        {\n            ExcelToPdfConverter converter = new ExcelToPdfConverter(spreadsheetControl.Workbook);\n            PdfDocument pdfDoc = new PdfDocument();\n\n            ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings();\n            settings.LayoutOptions = LayoutOptions.NoScaling;\n            settings.TemplateDocument = pdfDoc;\n            settings.DisplayGridLines = GridLinesDisplayStyle.Invisible;\n\n            pdfDoc = converter.Convert(settings);\n            pdfDoc.Save(SpreadsheetExportingDataSource.PdfOutputFileName);\n        }\n\n        #endregion\n\n        #region Image\n\n        /// <summary>\n        /// Renders the used range of the active worksheet into a bitmap.\n        /// </summary>\n        private static void ExportWorksheetToBitmap(Spreadsheet spreadsheetControl)\n        {\n            IWorksheet sheet = spreadsheetControl.Workbook.ActiveSheet;\n            sheet.UsedRangeIncludesFormatting = false;\n            int lastRow = sheet.UsedRange.LastRow + 1;\n            int lastColumn = sheet.UsedRange.LastColumn + 1;\n            using (Image img = sheet.ConvertToImage(1, 1, lastRow, lastColumn, ImageType.Bitmap, null))\n            {\n                img.Save(SpreadsheetExportingDataSource.ImageOutputFileName, ImageFormat.Png);\n            }\n        }\n\n        #endregion\n\n        #region HTML\n\n        /// <summary>\n        /// Saves the workbook as an HTML document.\n        /// </summary>\n        private static void ExportWorkbookToHTML(Spreadsheet spreadsheetControl)\n        {\n            spreadsheetControl.Workbook.SaveAsHtml(SpreadsheetExportingDataSource.HtmlOutputFileName, HtmlSaveOptions.Default);\n        }\n\n        #endregion\n    }\n}\n"
    }
  ]
}