PHP code example of label305 / xlsx-extractor

1. Go to this page and download the library: Download label305/xlsx-extractor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

label305 / xlsx-extractor example snippets


use Label305\XlsxExtractor\Basic\BasicExtractor;
use Label305\XlsxExtractor\Basic\BasicInjector;

$extractor = new BasicExtractor();
$mapping = $extractor->extractStringsAndCreateMappingFile(
    'simple.xlsx',
    'simple-extracted.xlsx'
  );

echo $mapping[0]; // Slide number one

$mapping[0] = "Slide number one";

$injector = new BasicInjector();
$injector->injectMappingAndCreateNewFile(
    $mapping,
    'simple-extracted.xlsx',
    'simple-injected.xlsx'
  );

$extractor = new DecoratedTextExtractor();
$mapping = $extractor->extractStringsAndCreateMappingFile(
    'markup.xlsx',
    'markup-extracted.xlsx'
  );
  
$firstSharedString = $mapping[0]; // SharedString object
$firstSharedStringPart = $firstParagraph[0]; // SharedStringPart object

$firstSharedStringPart->italic = true;
$firstSharedStringPart->bold = false;
$firstSharedStringPart->underline = true;

echo $firstSharedStringPart->text; // The quick brown fox jumps over the lazy dog
$firstSharedStringPart->text = "Several fabulous dixieland jazz groups played with quick tempo.";

$injector = new DecoratedTextInjector();
$injector->injectMappingAndCreateNewFile(
    $mapping,
    'markup-extracted.xlsx',
    'markup-injected.xlsx'
  );