Most popular tutorials
How to insert a page break without having a blank page?
Inserting page break without an extra blank page Integrating a page break to separate elements in a list is a standard practice, as illustrated in the provided DOCX template screenshot. However, a consequential issue arises during document generation—namely, the insertion of a page break for the last element in the loop results in an empty page in the final output. This article gives two solutions to avoid the blank page on the generated document. The provided solutions are predicated onPopularHow to create a template?
How create a template and render it on Carbone Studio? Create a template on Carbone studio is easy. You need LibreOffice or Microsoft word and a free account on Carbone Studio. Create a template You can create writer document, calc spreadsheet or event presentation. Open libre office or Microsoft word Choose the type of document you want. Design your template Then use your editor functionnalities to design it. You can add header, footer...PopularStyle guide to design a report
Carbone Style Guide This is the official style guide for the Carbone language. If you use Carbone in a project, it’s a great reference to avoid errors, bikeshedding, and anti-patterns. Essential These rules help prevent errors, so learn and abide by them at all costs. Exceptions may exist, but should be very rare and only be made by those with expert knowledge of Carbone. The following checklist avoids unexpected behaviors, avoids creating a corrupted document or avoids not printed valuePopularPrint a line feed into a document
Render a line feed into a document The line feed, also known as a "Carriage Return", a "New Line", and the n character, can be rendered into ODT and DOCX documents with the formatter ":convCRLF”. Learn more about the formatter: https://carbone.io/documentation.htmlconvcrlf- CRLF FoPopularFix Quotation Marks Issue
Common quotation marks errors If you are using single quotes, text editors may replace automatically them with "smart quotes" that are not supported by Carbone. If you are using double quotes to filter attributes d.list attributeValue="productstate" , you may encounter unexpected behaviors. Solution You must always use single quotes (also known as Straight quotes)! MS word: On the File tab click on Options Click on Proofing click on AutoCorrect OptioFew readersWhat is a Carbone tag?
What is a Carbone tag? Carbone tags are placeholders d. within the document template. The carbone engine recognizes tags and replaces with real data when generating reports. These tags are used to bind data from a JSON source to specific locations in the template, enabling the creation of personalized and data-driven documents. The "JSON data" can be a word, a sentence, a number, a date, image, barcode, charts, colors and more! A Carbone tag is also named "marker" or "placeholder". EFew readers
Print lists / Loop through arrays
How to keep merged rows inside a table loop?
How to keep merged rows inside a table loop? Carbone can't keep a merged rows when it is mixed with a loop of rows, the column will be transformed as a row on the generated report. This article is about creating a document that contains a table with merged columns mixed with loop of rows, such as: Table example with merge rows Solution Create a table inside a table, such as:Some readersHow to draw an horizontal repetition in a table (LibreOffice)?
Go to Insert -Section -Columns and set maximum number of column (here 5) In the first section, insert a table, and go to "Table Properties": 3Few readersPrint a list of strings
Print a list of strings / numbers The goal is to print each elements into a newline. The following JSON dataset is used as an example: The solution is to join all elements with new line characters n with :arrayJoin, then convert them into DOCX/ODS/ODT/PDF formats with :convCRLF, such as: ODT template edited with LibreOffice (https://storage.crisp.Few readers
Dynamic Pictures / Images
Insert dynamic images as shapes (rectangle with rounded corners)
Insert dynamic images as shapes First Solution Insert a shape into the document body, then fill it with an image. 1. Insert a shape into the document body Click on the Insert tab Shapes Select the shape you need. 2Some readersWhy dynamic pictures are not rendered into my document?
Dynamic pictures are not injected into a report When using dynamic pictures with image URLs or Data-URLs, images may not appear on the document If an error occurs, and a replacement error image is used (white crossed images). Error reasons (URL format) The file type is not provided by the file extension nor by the file mime-type (URL format) The file can't be download because of restrictions: the file is protected by a proxy,Few readersCreating Templates with Multi-Column Picture Injection
How to insert images dynamically into multiple columns ? Carbone v2, v3, and v4 currently require pre-formatted JSON datasets for dynamic picture injection into multiple columns. Format Your JSON Data: The only solution for the moment is to pre-format your JSON data-set with a list of a two pictures per object (or more if you have more columns), such as:Few readers
Show / Hide content
Why conditional formatters are adding empty lines? (showBegin/hideBegin)
Why conditional formatters are adding empty lines? (showBegin/hideBegin) First Solution When using conditional formatters showBegin/showEnd or hideBegin/hideEnd, insert only Break-lines (shift + Enter). It exist 2 ways to create a line: Break-line : The new line is part of the current paragraph by hitting shift + Enter. Behind the scenes, Carbone don't have to reorder the XML because everything is in the same paragraph. New-line : Close the current paragraph and oSome readersHow to hide an image conditionally
Hide or remove images conditionally from PDF, ODT or DOCX documentsSome readersHow to hide a paragraph conditionally
Hide or remove paragraphs conditionally from PDF, ODT or DOCX documentsSome readersHow to hide a table row conditionally
Hide or remove a table row conditionally from PDF, ODT or DOCX documentsSome readersHide a line if an element is empty
Hide or remove empty lines conditionally from PDF, ODT or DOCX documentsFew readersHow to hide shapes conditionally? (lines, circles, squares)
Hide or remove shapes conditionally from documents PDF, ODT or DOCXFew readersHow to hide charts conditionally
Hide, remove or delete charts conditionally from documents PDF, ODT or DOCXFew readers
What can I do when I got rendering error message? (List below)
When rendering reports through Carbone Cloud API & Studio, it is possible to receive error messages and it is due to design issue inside the template. If one of the following error occurs, read the Style Guide checklist. List of common errors: Error: could not open document : The generated document is corrupted due to a design issue, it can come from tags, loops, formatters, conditional blocks, dynamic coloSome readersInsert a watermark dynamically
Insert a watermark dynamically It exists 2 solutions: Insert a watermark as a Carbone tag on your template. It is possible to change the color, orientation, and opacity of the watermark. (e.g. Example 1 with Libre Office, Example 2 with MS Word) Insert a watermark as a PDF rendering option when requesting Carbone Render API. The watermark will be green, it is not possible to change the color, orientation, and opacity. (e.g. ESome readersConfigure authentification with Carbone docker image
How to enable authentication with Carbone docker By default, Carbone docker image is running without authentication. Please follow the steps below: Enable authentication options in Carbone You first need to set environment variable CARBONEEEAUTHENTICATION to true. If you use Studio (CARBONEEESTUDIO=true), don't forget to also enable security on it with : CARBONEEESTUDIOUSER=user:password Carbone key generation When running Carbone for the first time, if no keys are present,Few readersSetting PDF Page layout from your XLSX/ODS Template
The "Page Break View" in Microsoft Excel and LibreOffice is a feature that allows you to see and manipulate the page breaks within your worksheet. It provides a visual representation of how your Excel data is distributed across pages when the document is generated with Carbone: the PDF will inherit the template page layout. Here's how you can access the Page Break View: Define page layout in Microsoft Excel Open your Excel workbook: Open the Excel template that you're working on. GoFew readersHow to compute totals in Excel / Spreadsheets when Carbone injects new lines?
Problem Most spreadsheet reports need totals at the bottom of the table. Template But the bottom of the table is dynamically pushed down by Carbone when the data is inserted, so you cannot use a formula =SUM(B4:B5) because B5 is dynamic. It can be B88 or even B351 when Carbone has inserted the data. Here are two solutions: Use a dynamic Excel formula Use the SUM formula combined with INFew readersSetting PDF Page Size from your DOCX/ODT Template
In Microsoft Word or LibreOffice, you can set the page size for your template, and when generate a PDF with Carbone, the PDF will inherit the page size from the document. Here's how you can define the page size in Microsoft Word and LibreOffice. Define page size in Microsoft Word Open your Word template: If you haven't created your document yet, open a new Word document. Go to the "Layout" or "Page LayouFew readersHow to configure local in charts
How to configure number printing in chats with DOCX template ? Currently, if you wish to format the digits of a chart in "Number" format, the chart language is not affected by the Carbone configuration. Here's what you get with lang = fr : lang with charts Chart is always rendered with English (US) format 😭 However, you can force numbers to be formatted by configuring the formaFew readersHow to change the order of sections in my template?
Problem Your client want to hide/show and change the order of sections in a document dynamically. Solution Create your template containing all your information in a single table, where each row corresponds to a section to be displayed (or not) according to its order number defined in the json. . For example, this template with 5 rows : Template where the formula d.sectionOrder i :ifEQ('sec1'):keepFew readers