Category: PhpSpreadsheet
-
Create Excel Files With Printing Breaks Settings In PHP Using PHPSpreadSheet
To make sure the contents of the xlsx file is on it’s intended page, the function setBreak() can be used when coding with PhpSpreadsheet. This will make sure the data will start on which page it is set to begin with, leaving no doubt that the xlsx file generated will be printed correctly. Requirements: Composer […]
-
Create Excel Files With Header And Footer In PHP Using PHPSpreadSheet
With the simple setOddHeader() and setOddFooter() functions in PhpSpreadsheet, set a detailed document information at the top and at the bottom respectively. Short information such as the name of the document, company name, document title, page number data, or any other key specifics needed can be added. Some of the basic font design styles can […]
-
Create Excel Files With Center On Page Settings In PHP Using PHPSpreadSheet
At times, when creating an xlsx file, there is a need to put the data in center or in the middle of the page. This can be achieved by the use of Center on page options under the page setup. With PhpSpreadsheet, there is the function setHorizontalCentered() for centering horizontally, and the function setVerticalCentered() for […]
-
Create Excel Files With Page Margins Settings In PHP Using PHPSpreadSheet
Before printing an xlsx file, there are options to align it’s worksheet to make it look finer when printed. These are the adjustments on the white spaces at the top, bottom, left, and right sides of the document, these are commonly known as page margins. Requirements: Composer PHP 7.2 or newer Step 1. Setup dependencies. […]
-
Create Excel Files With Page Orientation And Paper Size Settings In PHP Using PHPSpreadSheet
When printing xlsx files, there are two (2) options of page orientation (the manner in which the paper will be printed), they are the portrait (vertically positioned page), and the landscape (horizontallly positioned page). The portrait option is the default setting when creating an xlsx file, but it can be programmatically changed with PhpSpreadsheet. Another […]
-
Create Excel Files With Explicit Cell Datatype In PHP Using PHPSpreadSheet
Explicitly set a cell’s datatype when creating an xslx file with PhpSpreadsheet. Requirements: Composer PHP 7.2 or newer Step 1. Setup dependencies. { “require”: { “phpoffice/phpspreadsheet”: “^1.3” } } composer.json Step 2. Install phpspreadsheet. $ composer install command line Step 3. Create a new PHP file, and start coding. <?php // Autoload dependencies require ‘vendor/autoload.php’; […]
-
Create Excel Files With Line Breaks In PHP Using PHPSpreadSheet
Using PhpSpreadsheet, write text contents in an xlsx file with each words or paragraphs on it’s own line. Requirements: Composer PHP 7.2 or newer Step 1. Setup dependencies. { “require”: { “phpoffice/phpspreadsheet”: “^1.3” } } composer.json Step 2. Install phpspreadsheet. $ composer install command line Step 3. Create a new PHP file, and start coding. […]
-
Create Excel Files With Formulas In PHP Using PHPSpreadSheet
Write formulas in an xlsx file, and easily compute for an average, sum a range of cell values, and even set a conditional formula based on a given cell value. These are just a few of the many formulas you can write in creating xlsx files with PhpSpreadsheet. Requirements: Composer PHP 7.2 or newer Step […]
-
Create Excel Files With Date And Time Data In PHP Using PHPSpreadSheet
Create a new xlsx file with correct cell date format settings. Requirements: Composer PHP 7.2 or newer Step 1. Setup dependencies. { “require”: { “phpoffice/phpspreadsheet”: “^1.3” } } composer.json Step 2. Install phpspreadsheet. $ composer install command line Step 3. Create a new PHP file, and start coding. <?php // Autoload dependencies require ‘vendor/autoload.php’; // […]