Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

excel-to-pdf-converter

Minimal examples for **Total Excel Converter X (ActiveX)**. Automate batch conversion of XLS/XLSX/CSV/ODS to PDF/TIFF/HTML/TXT via COM from C#, Delphi, VBScript, and PowerShell. Includes sheet/range selection, page setup, fit-to-page, headers/footers, merge, watermarks, and logging.

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

Excel to PDF Converter

Delphi project for converting Excel files (XLS, XLSX) to PDF format using TotalExcelConverterX COM component.

Requirements

Description

This project provides a simple interface for converting Microsoft Excel spreadsheets to PDF documents using the TotalExcelConverterX COM object from CoolUtils.

Supported Input Formats

  • XLS - Microsoft Excel 97-2003 spreadsheets
  • XLSX - Microsoft Excel 2007+ spreadsheets
  • XLSM - Excel macro-enabled workbooks
  • XLSB - Excel binary workbooks
  • SQLite - SQLite database
  • CSV - Comma-separated values files

Features

  • Excel to PDF conversion
  • Support for multiple Excel formats
  • Error handling and logging
  • Preserve spreadsheet formatting in PDF output
  • Configurable conversion parameters
  • Simple and clean code structure

Installation

Step 1: Install TotalExcelConverterX

  1. Download TotalExcelConverterX from https://www.coolutils.com/TotalExcelConverterX
  2. Install and register the component on your system
  3. Make sure the COM object is properly registered

Step 2: Clone and Build Project

bash
git clone https://github.com/yourusername/excel-to-pdf-converter.git
cd excel-to-pdf-converter

Open the project in Delphi 10.4 or later, build and run.

Usage

Basic Example

pascal
uses 
  Dialogs, 
  Vcl.OleAuto;

var
  Converter: OleVariant;
begin
  Converter := CreateOleObject('ExcelConverter.ExcelConverterX');
  Converter.Convert('c:\test\source.xlsx', 'c:\test\dest.pdf', '-cPDF -log c:\test\Excel.log');
  if Converter.ErrorMessage <> '' then
    ShowMessage(Converter.ErrorMessage);
end;

Using TExcelConverter Class

pascal
var
  Converter: TExcelConverter;
begin
  Converter := TExcelConverter.Create;
  try
    if Converter.ConvertExcelToPDF('spreadsheet.xlsx', 'output.pdf', 'conversion.log') then
      ShowMessage('Conversion completed!')
    else
      ShowMessage('Error: ' + Converter.LastError);
  finally
    Converter.Free;
  end;
end;

Configuration

You can modify the following parameters in the Convert method:

  • Source file path - path to input XLS/XLSX file
  • Destination PDF file path - path to output PDF file
  • Conversion options:
    • -cPDF - output format (note: no space after -c)
    • -log <path> - log file path
    • Additional parameters supported by TotalExcelConverterX

Error Handling

The application checks for error messages returned by the converter and displays them using a message dialog. All errors are also logged to the specified log file.

Project Structure

pascal
excel-to-pdf-converter/
????????? README.md
????????? LICENSE
????????? .gitignore
????????? uExcelConverter.pas        # Main converter unit
????????? ExcelToPDFConverter.dpr    # Example program

License

MIT License - see LICENSE file for details

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Author

Alexander Buzaev

Acknowledgments

Support

For issues with TotalExcelConverterX component, please refer to:

For issues with this Delphi wrapper, please open an issue on GitHub.