DDDTools is a Windows Forms application designed for Italian businesses to generate PDF receipts (ricevute) from transaction data stored in Excel files. The application automates the process of creating professional receipts with customer information, amounts in both numbers and Italian words, and tax details.
- 📄 PDF Receipt Generation: Generate professional PDF receipts from Excel data
- 🏦 Multiple Templates: Support for both bank (BANCA) and post office (POSTA) receipt templates
- 💰 Italian Number Conversion: Automatically converts amounts to Italian words (e.g., "cinquecento euro / 00")
- 📊 Excel Integration: Read and write transaction data to/from Excel files (.xlsx)
- 🔍 Fast Data Access: Optimized for quick access to recent invoices
- 🇮🇹 Italian Tax Fields: Handles Italian tax information (IVA/VAT, fiscal code, etc.)
- .NET Framework 4.5.2 or higher (recommended: 4.7.2 or 4.8)
- Windows 10 users: .NET Framework 4.8 may need to be installed separately. Download from: https://dotnet.microsoft.com/download/dotnet-framework/net48
- Windows 11 users: .NET Framework 4.8 is pre-installed
- Windows OS (Windows 7 SP1 or later)
- Excel files (.xlsx format) with transaction data
- PDF templates:
template-banca.pdfandtemplate-posta.pdf(must be in the application directory)
If the application flashes and closes immediately on Windows 10:
- Install .NET Framework 4.8: Download and install from Microsoft's website
- Check error messages: The application now displays error dialogs if something goes wrong
- Verify dependencies: Ensure
EPPlus.dllanditextsharp.dllare in the same folder asDDDTools.exe - Check Windows Event Viewer: Look for application errors in Windows Logs → Application
The Excel file should have the following structure:
- Rows 1-3: Header rows (labels/metadata, not data)
- Row 4 onwards: Data rows containing transaction records
Important: The ID is not stored in the Excel file. The ID is simply the row number (e.g., row 4 = ID "4", row 5 = ID "5", etc.). This means:
- When you enter an ID in the application, you're specifying which row to read/write
- The ID corresponds directly to the Excel row number
- No ID column exists in the Excel file - it's derived from the row position
| Column | Field | Description |
|---|---|---|
| 1 | Number | Receipt number |
| 2 | Year | Transaction year |
| 3 | Name | Customer first name |
| 4 | Surname | Customer last name |
| 5 | Address | Street address |
| 6 | CAP | Postal code |
| 7 | City | City name |
| 8 | Province | Province abbreviation |
| 9 | Fiscal Code | Codice fiscale |
| 10 | IVA | VAT number (Partita IVA) |
| 11 | Amount | Transaction amount in euros |
| 12 | Date | Transaction date |
Note: The ID used in the application is the Excel row number. For example, if your data starts at row 4, the first record has ID "4", the second has ID "5", etc.
- Launch the application
- Click "Carica Excel" (Load Excel) button
- Select your Excel file containing transaction data
- Wait for the progress bar to complete (the application will scan the file)
- Enter the ID (which is the Excel row number) of the transaction you want to generate a receipt for
- Important: The ID is the row number in Excel. Since data starts at row 4, the first record has ID "4", second has ID "5", etc.
- Tip: The last invoice ID is typically the highest row number in your Excel file (e.g., if your last data row is 100, the ID is "100")
- Click either:
- "Genera ricevuta (BANCA)" - For bank template
- "Genera ricevuta (POSTA)" - For post office template
- Choose where to save the PDF file
- The receipt will be generated with all customer and transaction details
- Click "Apri ultimo PDF generato" to open the last generated PDF
- Click "Apri Excel caricato" to open the loaded Excel file
Version 2.0 introduces significant performance improvements, especially for large Excel files:
- Before: The application loaded ALL rows from the Excel file into memory on startup
- After: Only scans metadata (last row, last ID) and loads records on-demand
- Impact: Initial load time reduced from 10-30 seconds to 1-2 seconds for large files (10,000+ rows)
- Pre-loads only the last 50 records for quick access to recent invoices
- Records are loaded on-demand when accessing older invoices
- Automatic cache management prevents memory bloat
- Impact: Most common use case (printing last invoice) is now instant
- Backward scanning to find the last row (faster than forward scanning)
- Records loaded only when needed via
GetById()method - Improved error handling with user-friendly messages
- Before: Dictionary access was not synchronized, causing potential race conditions when loading Excel files on a background thread while generating receipts on the UI thread
- After: All dictionary and metadata access is protected with locks, ensuring thread-safe operations
- Impact: Prevents
InvalidOperationExceptionand crashes when users generate receipts while Excel files are being loaded in the background - Technical: Uses
lockstatements to synchronize access to thedatabasedictionary and metadata fields (lastID,lastnumber,totalRows)
| Scenario | Version 1.0 | Version 2.0 | Improvement |
|---|---|---|---|
| Load 10,000 row Excel | 15-30 sec | 1-2 sec | ~90% faster |
| Print last invoice | 0.5-1 sec | Instant | ~100% faster |
| Print older invoice | 0.5-1 sec | 0.1-0.3 sec | ~70% faster |
| Memory usage | All rows | Last 50 rows | ~95% less |
The optimization uses:
- Lazy loading pattern: Data loaded only when requested
- LRU-style caching: Most recently accessed records stay in memory
- Efficient Excel scanning: Uses EPPlus Dimension property and backward iteration
- On-demand record loading:
GetRecord()method loads individual records from Excel when not in cache - Thread synchronization: All dictionary and metadata access protected with locks to prevent race conditions between background Excel loading and UI thread operations
DDDTools/
├── DDDTools/
│ ├── DataProcesser.cs # Excel data processing (optimized in v2.0)
│ ├── PdfGenerator.cs # PDF generation logic
│ ├── NumberToWords.cs # Italian number-to-words conversion
│ ├── Form2.cs # Main user interface
│ └── ...
└── README.md
- EPPlus (ExcelPackage) - For Excel file manipulation
- iTextSharp 5.5.10 - For PDF generation
See LICENSE file for details.
Created by Fabrizio Spoleti
Note: Make sure the PDF template files (template-banca.pdf and template-posta.pdf) are present in the application directory for the receipt generation to work properly.