|
| 1 | +# DevExpress Office File API - Process DOCX Documents, XLSX Spreadsheets, PPTX Presentations, and PDF Files in .NET Console Apps |
| 2 | + |
| 3 | +This folder contains console applications that use the DevExpress Office File API to process Microsoft Word, Excel, PowerPoint documents and PDF files. Included examples implement common scenarios, such as converting documents to different formats, extracting content, or modifying document properties. |
| 4 | + |
| 5 | +> Office, Excel, Word, PowerPoint are trademarks or registered trademarks of Microsoft Corporation. |
| 6 | +
|
| 7 | +## Process PDF Documents |
| 8 | + |
| 9 | +[DevExpress PDF Document API for .NET](https://www.devexpress.com/products/net/office-file-api/pdf/) allows you to generate, convert, merge, split, edit, password-protect, and digitally sign PDF files. |
| 10 | + |
| 11 | +For more information, refer to the product documentation: [DevExpress PDF Document API](https://docs.devexpress.com/OfficeFileAPI/16491/pdf-document-api). |
| 12 | + |
| 13 | +### Convert a PDF Document to PDF/A |
| 14 | + |
| 15 | +Converts a PDF file to PDF/A format. |
| 16 | + |
| 17 | +**Project folder**: *PdfProcessing* / *DocumentConversion* / *PdfToCompatible* |
| 18 | +**Files to review**: [Program.cs](./CS/PdfProcessing/DocumentConversion/PdfToCompatible/Program.cs) | [Program.vb](./VB/PdfProcessing/DocumentConversion/PdfToCompatible/Program.vb) |
| 19 | + |
| 20 | +### Convert a PDF Document to Images |
| 21 | + |
| 22 | +Exports PDF document pages as images. |
| 23 | + |
| 24 | +**Project folder**: *PdfProcessing* / *DocumentConversion* / *PdfToImage* |
| 25 | +**Files to review**: [Program.cs](./CS/PdfProcessing/DocumentConversion/PdfToImage/Program.cs) | [Program.vb](./VB/PdfProcessing/DocumentConversion/PdfToImage/Program.vb) |
| 26 | + |
| 27 | +### Add a Watermark to a PDF Document |
| 28 | + |
| 29 | +Adds a text watermark to a PDF document. |
| 30 | + |
| 31 | +**Project folder**: *PdfProcessing* / *DocumentProtection* / *PdfApplyWatermark* |
| 32 | +**Files to review**: [Program.cs](./CS/PdfProcessing/DocumentProtection/PdfApplyWatermark/Program.cs) | [Program.vb](./VB/PdfProcessing/DocumentProtection/PdfApplyWatermark/Program.vb) |
| 33 | + |
| 34 | +### Sign a PDF Document |
| 35 | + |
| 36 | +Signs a PDF document with a predefined certificate and applies signature appearance settings. |
| 37 | + |
| 38 | +**Project folder**: *PdfProcessing* / *DocumentProtection* / *PdfDigitalSignature* |
| 39 | +**Files to review**: [Program.cs](./CS/PdfProcessing/DocumentProtection/PdfDigitalSignature/Program.cs) | [Program.vb](./VB/PdfProcessing/DocumentProtection/PdfDigitalSignature/Program.vb) |
| 40 | + |
| 41 | +### Encrypt a PDF Document |
| 42 | + |
| 43 | +Encrypts a PDF document using the 256-bit AES algorithm and sets permissions (all Allowed). |
| 44 | + |
| 45 | +**Project folder**: *PdfProcessing* / *DocumentProtection* / *PdfEncryptPassword* |
| 46 | +**Files to review**: [Program.cs](./CS/PdfProcessing/DocumentProtection/PdfEncryptPassword/Program.cs) | [Program.vb](./VB/PdfProcessing/DocumentProtection/PdfEncryptPassword/Program.vb) |
| 47 | + |
| 48 | +### Redact a PDF Document |
| 49 | + |
| 50 | +Adds and applies redaction annotations to a PDF document. |
| 51 | + |
| 52 | +**Project folder**: *PdfProcessing* / *DocumentProtection* / *PdfRedaction* |
| 53 | +**Files to review**: [Program.cs](./CS/PdfProcessing/DocumentProtection/PdfRedaction/Program.cs) | [Program.vb](./VB/PdfProcessing/DocumentProtection/PdfRedaction/Program.vb) |
| 54 | + |
| 55 | +### Validate Signatures in a PDF Document |
| 56 | + |
| 57 | +Validates signatures in a signed PDF document and writes a text report (TXT). |
| 58 | + |
| 59 | +**Project folder**: *PdfProcessing* / *DocumentProtection* / *PdfValidateSignature* |
| 60 | +**Files to review**: [Program.cs](./CS/PdfProcessing/DocumentProtection/PdfValidateSignature/Program.cs) | [Program.vb](./VB/PdfProcessing/DocumentProtection/PdfValidateSignature/Program.vb) |
| 61 | + |
| 62 | +### Merge PDF Documents |
| 63 | + |
| 64 | +Merges multiple PDF documents into a single PDF document. |
| 65 | + |
| 66 | +**Project folder**: *PdfProcessing* / *DocumentConversion* / *PdfMergeDocuments* |
| 67 | +**Files to review**: [Program.cs](./CS/PdfProcessing/DocumentConversion/PdfMergeDocuments/Program.cs) | [Program.vb](./VB/PdfProcessing/MergeSplit/PdfMergeDocuments/Program.vb) |
| 68 | + |
| 69 | +### Split a PDF Document |
| 70 | + |
| 71 | +Splits a PDF document into multiple single-page PDF documents. |
| 72 | + |
| 73 | +**Project folder**: *PdfProcessing* / *MergeSplit* / *PdfSplitDocuments* |
| 74 | +**Files to review**: [Program.cs](./CS/PdfProcessing/MergeSplit/PdfSplitDocuments/Program.cs) | [Program.vb](./VB/PdfProcessing/MergeSplit/PdfSplitDocuments/Program.vb) |
| 75 | + |
| 76 | + |
| 77 | +## Process Word Documents |
| 78 | + |
| 79 | +[DevExpress Word (RTF) Document API](https://www.devexpress.com/products/net/office-file-api/word/) allows you to to create, read, edit, convert, merge, split, password-protect, and digitally sign Microsoft Word documents. |
| 80 | + |
| 81 | +For more information, refer to the product documentation: [Word Processing Document API](https://docs.devexpress.com/OfficeFileAPI/17488/word-processing-document-api). |
| 82 | + |
| 83 | +### Convert Word Document Pages to Images |
| 84 | + |
| 85 | +Exports Word document (DOCX) pages as PNG images. |
| 86 | + |
| 87 | +**Project folder**: *WordProcessing* / *DocumentConversion* / *WordToImage* |
| 88 | +**Files to review**: [Program.cs](./CS/WordProcessing/DocumentConversion/WordToImage/Program.cs) | [Program.vb](./VB/WordProcessing/DocumentConversion/WordToImage/Program.vb) |
| 89 | + |
| 90 | +### Convert a Word Document to PDF |
| 91 | + |
| 92 | +Converts a Word document (DOCX) to PDF format. |
| 93 | + |
| 94 | +**Project folder**: *WordProcessing* / *DocumentConversion* / *WordToPdf* |
| 95 | +**Files to review**: [Program.cs](./CS/WordProcessing/DocumentConversion/WordToPdf/Program.cs) | [Program.vb](./VB/WordProcessing/DocumentConversion/WordToPdf/Program.vb) |
| 96 | + |
| 97 | +### Convert a Word Document to Another Format |
| 98 | + |
| 99 | +Converts a Word document (DOCX) to the specified format. |
| 100 | + |
| 101 | +**Project folder**: *WordProcessing* / *DocumentConversion* / *WordToWord* |
| 102 | +**Files to review**: [Program.cs](./CS/WordProcessing/DocumentConversion/WordToWord/Program.cs) | [Program.vb](./VB/WordProcessing/DocumentConversion/WordToWord/Program.vb) |
| 103 | + |
| 104 | +### Add a Digital Signature to a Word Document |
| 105 | + |
| 106 | +Digitally signs a Word document with a predefined certificate. |
| 107 | + |
| 108 | +**Project folder**: *WordProcessing* / *DocumentProtection* / *WordDigitalSignature* |
| 109 | +**Files to review**: [Program.cs](./CS/WordProcessing/DocumentProtection/WordDigitalSignature/Program.cs) | [Program.vb](./VB/WordProcessing/DocumentProtection/WordDigitalSignature/Program.vb) |
| 110 | + |
| 111 | +### Encrypt a Word Document |
| 112 | + |
| 113 | +Encrypts and password-protects a Word document (DOCX). |
| 114 | + |
| 115 | +**Project folder**: *WordProcessing* / *DocumentProtection* / *WordEncryptPassword* |
| 116 | +**Files to review**: [Program.cs](./CS/WordProcessing/DocumentProtection/WordEncryptPassword/Program.cs) | [Program.vb](./VB/WordProcessing/DocumentProtection/WordEncryptPassword/Program.vb) |
| 117 | + |
| 118 | +### Restrict Word Document Modification |
| 119 | + |
| 120 | +Protects a Word document (DOCX) from unauthorized modifications (specifies an editing restriction password). |
| 121 | + |
| 122 | +**Project folder**: *WordProcessing* / *DocumentProtection* / *WordProtectPassword* |
| 123 | +**Files to review**: [Program.cs](./CS/WordProcessing/DocumentProtection/WordProtectPassword/Program.cs) | [Program.vb](./VB/WordProcessing/DocumentProtection/WordProtectPassword/Program.vb) |
| 124 | + |
| 125 | +### Mail Merge |
| 126 | + |
| 127 | +Fills a predefined mail-merge template with data to create personalized letters. |
| 128 | + |
| 129 | +**Project folder**: *WordProcessing* / *MailMergeFields* / *WordMailMerge* |
| 130 | +**Files to review**: [Program.cs](./CS/WordProcessing/MailMergeFields/WordMailMerge/Program.cs) | [Program.vb](./VB/WordProcessing/MailMergeFields/WordMailMerge/Program.vb) |
| 131 | + |
| 132 | +### Define Master-Detail Regions in a Template |
| 133 | + |
| 134 | +Generates an order report from a predefined master-detail mail-merge template. |
| 135 | + |
| 136 | +**Project folder**: *WordProcessing* / *MailMergeFields* / *WordMailMergeRegions* |
| 137 | +**Files to review**: [Program.cs](./CS/WordProcessing/MailMergeFields/WordMailMergeRegions/Program.cs) | [Program.vb](./VB/WordProcessing/MailMergeFields/WordMailMergeRegions/Program.vb) |
| 138 | + |
| 139 | +### Merge Multiple Documents |
| 140 | + |
| 141 | +Merges multiple Word documents (DOCX) into a single document (PDF). |
| 142 | + |
| 143 | +**Project folder**: *WordProcessing* / *MergeSplit* / *Merge* |
| 144 | +**Files to review**: [Program.cs](./CS/WordProcessing/MergeSplit/Merge/Program.cs) | [Program.vb](./VB/WordProcessing/MergeSplit/Merge/Program.vb) |
| 145 | + |
| 146 | +### Split a Word Document |
| 147 | + |
| 148 | +Splits a Word document (DOCX) into multiple documents by page, section, or heading. You can specify the output format (for example, DOCX or PDF). |
| 149 | + |
| 150 | +**Project folder**: *WordProcessing* / *MergeSplit* / *Split* |
| 151 | +**Files to review**: [Program.cs](./CS/WordProcessing/MergeSplit/Split/Program.cs) | [Program.vb](./VB/WordProcessing/MergeSplit/Split/Program.vb) |
| 152 | + |
| 153 | + |
| 154 | +## Process Excel Spreadsheets |
| 155 | + |
| 156 | +[DevExpress Excel Spreadsheet API for .NET](https://www.devexpress.com/products/net/office-file-api/spreadsheet/) allows you to create, read, write, convert, print, and protect Microsoft Excel files. |
| 157 | + |
| 158 | +For more information, refer to the product documentation: [Spreadsheet Document API](https://docs.devexpress.com/OfficeFileAPI/14912/spreadsheet-document-api). |
| 159 | + |
| 160 | + |
| 161 | +### Convert an Excel Spreadsheet to Another Format |
| 162 | + |
| 163 | +Converts a spreadsheet (XLSX) to the specified spreadsheet format. |
| 164 | + |
| 165 | +**Project folder**: *Spreadsheet* / *DocumentConversion* / *ExcelToExcel* |
| 166 | +**Files to review**: [Program.cs](./CS/Spreadsheet/DocumentConversion/ExcelToExcel/Program.cs) | [Program.vb](./VB/Spreadsheet/DocumentConversion/ExcelToExcel/Program.vb) |
| 167 | + |
| 168 | +### Convert an Excel Spreadsheet to PDF |
| 169 | + |
| 170 | +Converts a spreadsheet (XLSX) to PDF format. |
| 171 | + |
| 172 | +**Project folder**: *Spreadsheet* / *DocumentConversion* / *ExcelToPdf* |
| 173 | +**Files to review**: [Program.cs](./CS/Spreadsheet/DocumentConversion/ExcelToPdf/Program.cs) | [Program.vb](./VB/Spreadsheet/DocumentConversion/ExcelToPdf/Program.vb) |
| 174 | + |
| 175 | +### Convert an Excel Spreadsheet to Images |
| 176 | + |
| 177 | +Exports spreadsheet (XLSX) worksheets as PNG images. |
| 178 | + |
| 179 | +**Project folder**: *Spreadsheet* / *DocumentConversion* / *ExcelToImage* |
| 180 | +**Files to review**: [Program.cs](./CS/Spreadsheet/DocumentConversion/ExcelToImage/Program.cs) | [Program.vb](./VB/Spreadsheet/DocumentConversion/ExcelToImage/Program.vb) |
| 181 | + |
| 182 | +### Convert an Excel Worksheet to HTML |
| 183 | + |
| 184 | +Converts a worksheet (XLSX) to HTML format. |
| 185 | + |
| 186 | +**Project folder**: *Spreadsheet* / *DocumentConversion* / *ExcelToHtml* |
| 187 | +**Files to review**: [Program.cs](./CS/Spreadsheet/DocumentConversion/ExcelToHtml/Program.cs) | [Program.vb](./VB/Spreadsheet/DocumentConversion/ExcelToHtml/Program.vb) |
| 188 | + |
| 189 | +### Add a Digital Signature to an Excel Spreadsheet |
| 190 | + |
| 191 | +Digitally signs a spreadsheet (XLSX) with a predefined certificate. |
| 192 | + |
| 193 | +**Project folder**: *Spreadsheet* / *DocumentProtection* / *ExcelDigitalSignature* |
| 194 | +**Files to review**: [Program.cs](./CS/Spreadsheet/DocumentProtection/ExcelDigitalSignature/Program.cs) | [Program.vb](./VB/Spreadsheet/DocumentProtection/ExcelDigitalSignature/Program.vb) |
| 195 | + |
| 196 | +### Encrypt an Excel Spreadsheet |
| 197 | + |
| 198 | +Encrypts and password-protects a spreadsheet (XLSX). |
| 199 | + |
| 200 | +**Project folder**: *Spreadsheet* / *DocumentProtection* / *ExcelEncryptPassword* |
| 201 | +**Files to review**: [Program.cs](./CS/Spreadsheet/DocumentProtection/ExcelEncryptPassword/Program.cs) | [Program.vb](./VB/Spreadsheet/DocumentProtection/ExcelEncryptPassword/Program.vb) |
| 202 | + |
| 203 | +### Restrict Excel Worksheet Modification |
| 204 | + |
| 205 | +Protects worksheet cell content from modifications (adds an editing restriction password). |
| 206 | + |
| 207 | +**Project folder**: *Spreadsheet* / *DocumentProtection* / *ExcelProtectWorkbook* |
| 208 | +**Files to review**: [Program.cs](./CS/Spreadsheet/DocumentProtection/ExcelProtectWorkbook/Program.cs) | [Program.vb](./VB/Spreadsheet/DocumentProtection/ExcelProtectWorkbook/Program.vb) |
| 209 | + |
| 210 | +### Restrict Excel Workbook Modification |
| 211 | + |
| 212 | +Protects a workbook from structural changes (sets a password for add/delete/rename worksheet operations). |
| 213 | + |
| 214 | +**Project folder**: *Spreadsheet* / *DocumentProtection* / *ExcelProtectWorksheet* |
| 215 | +**Files to review**: [Program.cs](./CS/Spreadsheet/DocumentProtection/ExcelProtectWorksheet/Program.cs) | [Program.vb](./VB/Spreadsheet/DocumentProtection/ExcelProtectWorksheet/Program.vb) |
| 216 | + |
| 217 | +### Merge Excel Spreadsheets |
| 218 | + |
| 219 | +Merges multiple spreadsheets (XLSX) into a single spreadsheet (XLSX). |
| 220 | + |
| 221 | +**Project folder**: *Spreadsheet* / *MergeSplitDocuments* / *ExcelMergeWorkbooks* |
| 222 | +**Files to review**: [Program.cs](./CS/Spreadsheet/MergeSplitDocuments/ExcelMergeWorkbooks/Program.cs) | [Program.vb](./VB/Spreadsheet/MergeSplitDocuments/ExcelMergeWorkbooks/Program.vb) |
| 223 | + |
| 224 | +### Split an Excel Spreadsheet |
| 225 | + |
| 226 | +Splits a spreadsheet (XLSX) into multiple single-sheet spreadsheets (XLSX) or PDF documents. |
| 227 | + |
| 228 | +**Project folder**: *Spreadsheet* / *MergeSplitDocuments* / *ExcelSplitWorkbooks* |
| 229 | +**Files to review**: [Program.cs](./CS/Spreadsheet/MergeSplitDocuments/ExcelSplitWorkbooks/Program.cs) | [Program.vb](./VB/Spreadsheet/MergeSplitDocuments/ExcelSplitWorkbooks/Program.vb) |
| 230 | + |
| 231 | +## Process PowerPoint Presentations |
| 232 | + |
| 233 | +[DevExpress PowerPoint Presentation API for .NET](https://www.devexpress.com/products/net/office-file-api/powerpoint-presentation-api/) allows you to generate, edit, merge, print/export, and digitally sign Microsoft PowerPoint® files. |
| 234 | + |
| 235 | +For more information, refer to the product documentation: [DevExpress Presentation API](https://docs.devexpress.com/OfficeFileAPI/405405/presentation-api/overview). |
| 236 | + |
| 237 | +### Convert a Presentation to PDF |
| 238 | + |
| 239 | +Converts a PPTX presentation to PDF format. |
| 240 | + |
| 241 | +**Project folder**: *PowerPointPresentation* / *DocumentConversion* / *PresentationToPdf* |
| 242 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/DocumentConversion/PresentationToPdf/Program.cs) | [Program.vb](./VB/PowerPointPresentation/DocumentConversion/PresentationToPdf/Program.vb) |
| 243 | + |
| 244 | +### Convert a Presentation to Another Format |
| 245 | + |
| 246 | +Converts a PPTX presentation to the specified format. |
| 247 | + |
| 248 | +**Project folder**: *PowerPointPresentation* / *DocumentConversion* / *PresentationToPresentation* |
| 249 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/DocumentConversion/PresentationToPresentation/Program.cs) | [Program.vb](./VB/PowerPointPresentation/DocumentConversion/PresentationToPresentation/Program.vb) |
| 250 | + |
| 251 | +### Add Speaker Notes to a Presentation |
| 252 | + |
| 253 | +Adds text notes to each slide in a presentation. |
| 254 | + |
| 255 | +**Project folder**: *PowerPointPresentation* / *DocumentElements* / *PresentationNotes* |
| 256 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/DocumentElements/PresentationNotes/Program.cs) | [Program.vb](./VB/PowerPointPresentation/DocumentElements/PresentationNotes/Program.vb) |
| 257 | + |
| 258 | +### Add a Table to a Presentation Slide |
| 259 | + |
| 260 | +Creates a presentation slide with a table. |
| 261 | + |
| 262 | +**Project folder**: *PowerPointPresentation* / *DocumentElements* / *PresentationTables* |
| 263 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/DocumentElements/PresentationTables/Program.cs) | [Program.vb](./VB/PowerPointPresentation/DocumentElements/PresentationTables/Program.vb) |
| 264 | + |
| 265 | +### Merge Presentations |
| 266 | + |
| 267 | +Merges multiple presentations into a single presentation. |
| 268 | + |
| 269 | +**Project folder**: *PowerPointPresentation* / *MergeSplit* / *PresentationMerge* |
| 270 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/MergeSplit/PresentationMerge/Program.cs) | [Program.vb](./VB/PowerPointPresentation/MergeSplit/PresentationMerge/Program.vb) |
| 271 | + |
| 272 | +### Split a Presentation |
| 273 | + |
| 274 | +Splits a presentation into multiple single-slide presentations in PPTX or PDF format. |
| 275 | + |
| 276 | +**Project folder**: *PowerPointPresentation* / *MergeSplit* / *PresentationSplit* |
| 277 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/MergeSplit/PresentationSplit/Program.cs) | [Program.vb](./VB/PowerPointPresentation/MergeSplit/PresentationSplit/Program.vb) |
| 278 | + |
| 279 | +### Extract Images from a Presentation |
| 280 | + |
| 281 | +Extracts all images from slides and saves them as PNG files. |
| 282 | + |
| 283 | +**Project folder**: *PowerPointPresentation* / *SearchExtract* / *PresentationExtractImages* |
| 284 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/SearchExtract/PresentationExtractImages/Program.cs) | [Program.vb](./VB/PowerPointPresentation/SearchExtract/PresentationExtractImages/Program.vb) |
| 285 | + |
| 286 | +### Extract Text from a Presentation |
| 287 | + |
| 288 | +Extracts text from slide shapes, tables, and notes to a TXT file. |
| 289 | + |
| 290 | +**Project folder**: *PowerPointPresentation* / *SearchExtract* / *PresentationExtractText* |
| 291 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/SearchExtract/PresentationExtractText/Program.cs) | [Program.vb](./VB/PowerPointPresentation/SearchExtract/PresentationExtractText/Program.vb) |
| 292 | + |
| 293 | +### Find and Replace Text in a Presentation |
| 294 | + |
| 295 | +Finds text in slide shapes and tables. Replaces, removes, or highlights found text. |
| 296 | + |
| 297 | +**Project folder**: *PowerPointPresentation* / *SearchExtract* / *PresentationFindReplace* |
| 298 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/SearchExtract/PresentationFindReplace/Program.cs) | [Program.vb](./VB/PowerPointPresentation/SearchExtract/PresentationFindReplace/Program.vb) |
| 299 | + |
| 300 | +### Extract Presentation Metadata |
| 301 | + |
| 302 | +Extracts metadata (such as title, author, and creation date) from a presentation. |
| 303 | + |
| 304 | +**Project folder**: *PowerPointPresentation* / *SearchExtract* / *PresentationMetadata* |
| 305 | +**Files to review**: [Program.cs](./CS/PowerPointPresentation/SearchExtract/PresentationMetadata/Program.cs) | [Program.vb](./VB/PowerPointPresentation/SearchExtract/PresentationMetadata/Program.vb) |
| 306 | + |
| 307 | +## More Examples |
| 308 | + |
| 309 | +- [Office File API Online Demos](https://demos.devexpress.com/OfficeFileAPI/BlazorServer/) |
| 310 | +- [Word Processing Document API – How to Process Word Documents in Code](https://github.com/DevExpress-Examples/word-document-api-examples) |
| 311 | +- [Spreadsheet Document API – How to Process Spreadsheet Documents in Code (Part 1)](https://github.com/DevExpress-Examples/spreadsheet-document-api-examples-part1) |
| 312 | +- [Spreadsheet Document API – How to Process Spreadsheet Documents in Code (Part 2)](https://github.com/DevExpress-Examples/spreadsheet-document-api-examples-part2) |
0 commit comments