Merge branch 'master' into add-editorconfig
This commit is contained in:
commit
b7385e2053
|
|
@ -18,23 +18,39 @@ class Namespaces
|
||||||
|
|
||||||
const THEME = 'http://schemas.openxmlformats.org/package/2006/relationships/theme';
|
const THEME = 'http://schemas.openxmlformats.org/package/2006/relationships/theme';
|
||||||
|
|
||||||
|
const THEME2 = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme';
|
||||||
|
|
||||||
const COMPATIBILITY = 'http://schemas.openxmlformats.org/markup-compatibility/2006';
|
const COMPATIBILITY = 'http://schemas.openxmlformats.org/markup-compatibility/2006';
|
||||||
|
|
||||||
const MAIN = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main';
|
const MAIN = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main';
|
||||||
|
|
||||||
|
const RELATIONSHIPS_DRAWING = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing';
|
||||||
|
|
||||||
const DRAWINGML = 'http://schemas.openxmlformats.org/drawingml/2006/main';
|
const DRAWINGML = 'http://schemas.openxmlformats.org/drawingml/2006/main';
|
||||||
|
|
||||||
const CHART = 'http://schemas.openxmlformats.org/drawingml/2006/chart';
|
const CHART = 'http://schemas.openxmlformats.org/drawingml/2006/chart';
|
||||||
|
|
||||||
|
const CHART_ALTERNATE = 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart';
|
||||||
|
|
||||||
|
const RELATIONSHIPS_CHART = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart';
|
||||||
|
|
||||||
const SPREADSHEET_DRAWING = 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing';
|
const SPREADSHEET_DRAWING = 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing';
|
||||||
|
|
||||||
const SCHEMA_OFFICE_DOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
|
const SCHEMA_OFFICE_DOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
|
||||||
|
|
||||||
const COMMENTS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments';
|
const COMMENTS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments';
|
||||||
|
|
||||||
//const CUSTOM_PROPERTIES = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties';
|
const RELATIONSHIPS_CUSTOM_PROPERTIES = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties';
|
||||||
|
|
||||||
//const EXTENDED_PROPERTIES = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties';
|
const RELATIONSHIPS_EXTENDED_PROPERTIES = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties';
|
||||||
|
|
||||||
|
const RELATIONSHIPS_CTRLPROP = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp';
|
||||||
|
|
||||||
|
const CUSTOM_PROPERTIES = 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties';
|
||||||
|
|
||||||
|
const EXTENDED_PROPERTIES = 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties';
|
||||||
|
|
||||||
|
const PROPERTIES_VTYPES = 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes';
|
||||||
|
|
||||||
const HYPERLINK = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink';
|
const HYPERLINK = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink';
|
||||||
|
|
||||||
|
|
@ -58,13 +74,29 @@ class Namespaces
|
||||||
|
|
||||||
const VBA = 'http://schemas.microsoft.com/office/2006/relationships/vbaProject';
|
const VBA = 'http://schemas.microsoft.com/office/2006/relationships/vbaProject';
|
||||||
|
|
||||||
|
const VBA_SIGNATURE = 'http://schemas.microsoft.com/office/2006/relationships/vbaProject';
|
||||||
|
|
||||||
const DATA_VALIDATIONS1 = 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/main';
|
const DATA_VALIDATIONS1 = 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/main';
|
||||||
|
|
||||||
const DATA_VALIDATIONS2 = 'http://schemas.microsoft.com/office/excel/2006/main';
|
const DATA_VALIDATIONS2 = 'http://schemas.microsoft.com/office/excel/2006/main';
|
||||||
|
|
||||||
|
const CONTENT_TYPES = 'http://schemas.openxmlformats.org/package/2006/content-types';
|
||||||
|
|
||||||
|
const RELATIONSHIPS_PRINTER_SETTINGS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings';
|
||||||
|
|
||||||
|
const RELATIONSHIPS_TABLE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/table';
|
||||||
|
|
||||||
|
const SPREADSHEETML_AC = 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac';
|
||||||
|
|
||||||
const DC_ELEMENTS = 'http://purl.org/dc/elements/1.1/';
|
const DC_ELEMENTS = 'http://purl.org/dc/elements/1.1/';
|
||||||
|
|
||||||
const DC_TERMS = 'http://purl.org/dc/terms';
|
const DC_TERMS = 'http://purl.org/dc/terms/';
|
||||||
|
|
||||||
|
const DC_DCMITYPE = 'http://purl.org/dc/dcmitype/';
|
||||||
|
|
||||||
|
const SCHEMA_INSTANCE = 'http://www.w3.org/2001/XMLSchema-instance';
|
||||||
|
|
||||||
|
const URN_EXCEL = 'urn:schemas-microsoft-com:office:excel';
|
||||||
|
|
||||||
const URN_MSOFFICE = 'urn:schemas-microsoft-com:office:office';
|
const URN_MSOFFICE = 'urn:schemas-microsoft-com:office:office';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
|
||||||
use PhpOffice\PhpSpreadsheet\Chart\Properties;
|
use PhpOffice\PhpSpreadsheet\Chart\Properties;
|
||||||
use PhpOffice\PhpSpreadsheet\Chart\Title;
|
use PhpOffice\PhpSpreadsheet\Chart\Title;
|
||||||
use PhpOffice\PhpSpreadsheet\Chart\TrendLine;
|
use PhpOffice\PhpSpreadsheet\Chart\TrendLine;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException;
|
use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException;
|
||||||
|
|
||||||
|
|
@ -48,9 +49,9 @@ class Chart extends WriterPart
|
||||||
|
|
||||||
// c:chartSpace
|
// c:chartSpace
|
||||||
$objWriter->startElement('c:chartSpace');
|
$objWriter->startElement('c:chartSpace');
|
||||||
$objWriter->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
|
$objWriter->writeAttribute('xmlns:c', Namespaces::CHART);
|
||||||
$objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
|
$objWriter->writeAttribute('xmlns:a', Namespaces::DRAWINGML);
|
||||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
$objWriter->writeAttribute('xmlns:r', Namespaces::SCHEMA_OFFICE_DOCUMENT);
|
||||||
|
|
||||||
$objWriter->startElement('c:date1904');
|
$objWriter->startElement('c:date1904');
|
||||||
$objWriter->writeAttribute('val', '0');
|
$objWriter->writeAttribute('val', '0');
|
||||||
|
|
@ -1553,11 +1554,11 @@ class Chart extends WriterPart
|
||||||
private function writeAlternateContent(XMLWriter $objWriter): void
|
private function writeAlternateContent(XMLWriter $objWriter): void
|
||||||
{
|
{
|
||||||
$objWriter->startElement('mc:AlternateContent');
|
$objWriter->startElement('mc:AlternateContent');
|
||||||
$objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
|
$objWriter->writeAttribute('xmlns:mc', Namespaces::COMPATIBILITY);
|
||||||
|
|
||||||
$objWriter->startElement('mc:Choice');
|
$objWriter->startElement('mc:Choice');
|
||||||
$objWriter->writeAttribute('Requires', 'c14');
|
$objWriter->writeAttribute('Requires', 'c14');
|
||||||
$objWriter->writeAttribute('xmlns:c14', 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart');
|
$objWriter->writeAttribute('xmlns:c14', Namespaces::CHART_ALTERNATE);
|
||||||
|
|
||||||
$objWriter->startElement('c14:style');
|
$objWriter->startElement('c14:style');
|
||||||
$objWriter->writeAttribute('val', '102');
|
$objWriter->writeAttribute('val', '102');
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
use PhpOffice\PhpSpreadsheet\Comment;
|
use PhpOffice\PhpSpreadsheet\Comment;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
|
|
||||||
class Comments extends WriterPart
|
class Comments extends WriterPart
|
||||||
|
|
@ -40,7 +41,7 @@ class Comments extends WriterPart
|
||||||
|
|
||||||
// comments
|
// comments
|
||||||
$objWriter->startElement('comments');
|
$objWriter->startElement('comments');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
$objWriter->writeAttribute('xmlns', Namespaces::MAIN);
|
||||||
|
|
||||||
// Loop through authors
|
// Loop through authors
|
||||||
$objWriter->startElement('authors');
|
$objWriter->startElement('authors');
|
||||||
|
|
@ -107,9 +108,9 @@ class Comments extends WriterPart
|
||||||
|
|
||||||
// xml
|
// xml
|
||||||
$objWriter->startElement('xml');
|
$objWriter->startElement('xml');
|
||||||
$objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
|
$objWriter->writeAttribute('xmlns:v', Namespaces::URN_VML);
|
||||||
$objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
|
$objWriter->writeAttribute('xmlns:o', Namespaces::URN_MSOFFICE);
|
||||||
$objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
|
$objWriter->writeAttribute('xmlns:x', Namespaces::URN_EXCEL);
|
||||||
|
|
||||||
// o:shapelayout
|
// o:shapelayout
|
||||||
$objWriter->startElement('o:shapelayout');
|
$objWriter->startElement('o:shapelayout');
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\File;
|
use PhpOffice\PhpSpreadsheet\Shared\File;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
@ -32,7 +33,7 @@ class ContentTypes extends WriterPart
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
$objWriter->startElement('Types');
|
$objWriter->startElement('Types');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
|
$objWriter->writeAttribute('xmlns', Namespaces::CONTENT_TYPES);
|
||||||
|
|
||||||
// Theme
|
// Theme
|
||||||
$this->writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
|
$this->writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
use PhpOffice\PhpSpreadsheet\DefinedName;
|
use PhpOffice\PhpSpreadsheet\DefinedName;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet as ActualWorksheet;
|
||||||
|
|
||||||
class DefinedNames
|
class DefinedNames
|
||||||
{
|
{
|
||||||
|
|
@ -98,7 +98,7 @@ class DefinedNames
|
||||||
/**
|
/**
|
||||||
* Write Defined Name for autoFilter.
|
* Write Defined Name for autoFilter.
|
||||||
*/
|
*/
|
||||||
private function writeNamedRangeForAutofilter(Worksheet $worksheet, int $worksheetId = 0): void
|
private function writeNamedRangeForAutofilter(ActualWorksheet $worksheet, int $worksheetId = 0): void
|
||||||
{
|
{
|
||||||
// NamedRange for autoFilter
|
// NamedRange for autoFilter
|
||||||
$autoFilterRange = $worksheet->getAutoFilter()->getRange();
|
$autoFilterRange = $worksheet->getAutoFilter()->getRange();
|
||||||
|
|
@ -112,7 +112,7 @@ class DefinedNames
|
||||||
$range = Coordinate::splitRange($autoFilterRange);
|
$range = Coordinate::splitRange($autoFilterRange);
|
||||||
$range = $range[0];
|
$range = $range[0];
|
||||||
// Strip any worksheet ref so we can make the cell ref absolute
|
// Strip any worksheet ref so we can make the cell ref absolute
|
||||||
[, $range[0]] = Worksheet::extractSheetTitle($range[0], true);
|
[, $range[0]] = ActualWorksheet::extractSheetTitle($range[0], true);
|
||||||
|
|
||||||
$range[0] = Coordinate::absoluteCoordinate($range[0]);
|
$range[0] = Coordinate::absoluteCoordinate($range[0]);
|
||||||
if (count($range) > 1) {
|
if (count($range) > 1) {
|
||||||
|
|
@ -129,7 +129,7 @@ class DefinedNames
|
||||||
/**
|
/**
|
||||||
* Write Defined Name for PrintTitles.
|
* Write Defined Name for PrintTitles.
|
||||||
*/
|
*/
|
||||||
private function writeNamedRangeForPrintTitles(Worksheet $worksheet, int $worksheetId = 0): void
|
private function writeNamedRangeForPrintTitles(ActualWorksheet $worksheet, int $worksheetId = 0): void
|
||||||
{
|
{
|
||||||
// NamedRange for PrintTitles
|
// NamedRange for PrintTitles
|
||||||
if ($worksheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $worksheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
|
if ($worksheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $worksheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
|
||||||
|
|
@ -167,7 +167,7 @@ class DefinedNames
|
||||||
/**
|
/**
|
||||||
* Write Defined Name for PrintTitles.
|
* Write Defined Name for PrintTitles.
|
||||||
*/
|
*/
|
||||||
private function writeNamedRangeForPrintArea(Worksheet $worksheet, int $worksheetId = 0): void
|
private function writeNamedRangeForPrintArea(ActualWorksheet $worksheet, int $worksheetId = 0): void
|
||||||
{
|
{
|
||||||
// NamedRange for PrintArea
|
// NamedRange for PrintArea
|
||||||
if ($worksheet->getPageSetup()->isPrintAreaSet()) {
|
if ($worksheet->getPageSetup()->isPrintAreaSet()) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Document\Properties;
|
use PhpOffice\PhpSpreadsheet\Document\Properties;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
@ -29,8 +30,8 @@ class DocProps extends WriterPart
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
$objWriter->startElement('Properties');
|
$objWriter->startElement('Properties');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
|
$objWriter->writeAttribute('xmlns', Namespaces::EXTENDED_PROPERTIES);
|
||||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
$objWriter->writeAttribute('xmlns:vt', Namespaces::PROPERTIES_VTYPES);
|
||||||
|
|
||||||
// Application
|
// Application
|
||||||
$objWriter->writeElement('Application', 'Microsoft Excel');
|
$objWriter->writeElement('Application', 'Microsoft Excel');
|
||||||
|
|
@ -124,11 +125,11 @@ class DocProps extends WriterPart
|
||||||
|
|
||||||
// cp:coreProperties
|
// cp:coreProperties
|
||||||
$objWriter->startElement('cp:coreProperties');
|
$objWriter->startElement('cp:coreProperties');
|
||||||
$objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
|
$objWriter->writeAttribute('xmlns:cp', Namespaces::CORE_PROPERTIES2);
|
||||||
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
|
$objWriter->writeAttribute('xmlns:dc', Namespaces::DC_ELEMENTS);
|
||||||
$objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
|
$objWriter->writeAttribute('xmlns:dcterms', Namespaces::DC_TERMS);
|
||||||
$objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/');
|
$objWriter->writeAttribute('xmlns:dcmitype', Namespaces::DC_DCMITYPE);
|
||||||
$objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
$objWriter->writeAttribute('xmlns:xsi', Namespaces::SCHEMA_INSTANCE);
|
||||||
|
|
||||||
// dc:creator
|
// dc:creator
|
||||||
$objWriter->writeElement('dc:creator', $spreadsheet->getProperties()->getCreator());
|
$objWriter->writeElement('dc:creator', $spreadsheet->getProperties()->getCreator());
|
||||||
|
|
@ -198,8 +199,8 @@ class DocProps extends WriterPart
|
||||||
|
|
||||||
// cp:coreProperties
|
// cp:coreProperties
|
||||||
$objWriter->startElement('Properties');
|
$objWriter->startElement('Properties');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties');
|
$objWriter->writeAttribute('xmlns', Namespaces::CUSTOM_PROPERTIES);
|
||||||
$objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
|
$objWriter->writeAttribute('xmlns:vt', Namespaces::PROPERTIES_VTYPES);
|
||||||
|
|
||||||
foreach ($customPropertyList as $key => $customProperty) {
|
foreach ($customPropertyList as $key => $customProperty) {
|
||||||
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
|
$propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\Drawing as SharedDrawing;
|
use PhpOffice\PhpSpreadsheet\Shared\Drawing as SharedDrawing;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
@ -34,8 +35,8 @@ class Drawing extends WriterPart
|
||||||
|
|
||||||
// xdr:wsDr
|
// xdr:wsDr
|
||||||
$objWriter->startElement('xdr:wsDr');
|
$objWriter->startElement('xdr:wsDr');
|
||||||
$objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
|
$objWriter->writeAttribute('xmlns:xdr', Namespaces::SPREADSHEET_DRAWING);
|
||||||
$objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
|
$objWriter->writeAttribute('xmlns:a', Namespaces::DRAWINGML);
|
||||||
|
|
||||||
// Loop through images and write drawings
|
// Loop through images and write drawings
|
||||||
$i = 1;
|
$i = 1;
|
||||||
|
|
@ -159,10 +160,10 @@ class Drawing extends WriterPart
|
||||||
|
|
||||||
$objWriter->startElement('a:graphic');
|
$objWriter->startElement('a:graphic');
|
||||||
$objWriter->startElement('a:graphicData');
|
$objWriter->startElement('a:graphicData');
|
||||||
$objWriter->writeAttribute('uri', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
|
$objWriter->writeAttribute('uri', Namespaces::CHART);
|
||||||
$objWriter->startElement('c:chart');
|
$objWriter->startElement('c:chart');
|
||||||
$objWriter->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
|
$objWriter->writeAttribute('xmlns:c', Namespaces::CHART);
|
||||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
$objWriter->writeAttribute('xmlns:r', Namespaces::SCHEMA_OFFICE_DOCUMENT);
|
||||||
$objWriter->writeAttribute('r:id', 'rId' . $relationId);
|
$objWriter->writeAttribute('r:id', 'rId' . $relationId);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
@ -265,7 +266,7 @@ class Drawing extends WriterPart
|
||||||
|
|
||||||
// a:blip
|
// a:blip
|
||||||
$objWriter->startElement('a:blip');
|
$objWriter->startElement('a:blip');
|
||||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
$objWriter->writeAttribute('xmlns:r', Namespaces::SCHEMA_OFFICE_DOCUMENT);
|
||||||
$objWriter->writeAttribute('r:embed', 'rId' . $relationId);
|
$objWriter->writeAttribute('r:embed', 'rId' . $relationId);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
|
|
@ -362,9 +363,9 @@ class Drawing extends WriterPart
|
||||||
|
|
||||||
// xml
|
// xml
|
||||||
$objWriter->startElement('xml');
|
$objWriter->startElement('xml');
|
||||||
$objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
|
$objWriter->writeAttribute('xmlns:v', Namespaces::URN_VML);
|
||||||
$objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
|
$objWriter->writeAttribute('xmlns:o', Namespaces::URN_MSOFFICE);
|
||||||
$objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
|
$objWriter->writeAttribute('xmlns:x', Namespaces::URN_EXCEL);
|
||||||
|
|
||||||
// o:shapelayout
|
// o:shapelayout
|
||||||
$objWriter->startElement('o:shapelayout');
|
$objWriter->startElement('o:shapelayout');
|
||||||
|
|
@ -558,7 +559,7 @@ class Drawing extends WriterPart
|
||||||
}
|
}
|
||||||
|
|
||||||
$objWriter->startElement('a:hlinkClick');
|
$objWriter->startElement('a:hlinkClick');
|
||||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
$objWriter->writeAttribute('xmlns:r', Namespaces::SCHEMA_OFFICE_DOCUMENT);
|
||||||
$objWriter->writeAttribute('r:id', 'rId' . $hlinkClickId);
|
$objWriter->writeAttribute('r:id', 'rId' . $hlinkClickId);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing;
|
use PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing;
|
||||||
|
|
@ -30,7 +31,7 @@ class Rels extends WriterPart
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS);
|
||||||
|
|
||||||
$customPropertyList = $spreadsheet->getProperties()->getCustomProperties();
|
$customPropertyList = $spreadsheet->getProperties()->getCustomProperties();
|
||||||
if (!empty($customPropertyList)) {
|
if (!empty($customPropertyList)) {
|
||||||
|
|
@ -38,7 +39,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
4,
|
4,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
|
Namespaces::RELATIONSHIPS_CUSTOM_PROPERTIES,
|
||||||
'docProps/custom.xml'
|
'docProps/custom.xml'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +48,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
3,
|
3,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
|
Namespaces::RELATIONSHIPS_EXTENDED_PROPERTIES,
|
||||||
'docProps/app.xml'
|
'docProps/app.xml'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
2,
|
2,
|
||||||
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
|
Namespaces::CORE_PROPERTIES,
|
||||||
'docProps/core.xml'
|
'docProps/core.xml'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -63,7 +64,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
1,
|
1,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
|
Namespaces::OFFICE_DOCUMENT,
|
||||||
'xl/workbook.xml'
|
'xl/workbook.xml'
|
||||||
);
|
);
|
||||||
// a custom UI in workbook ?
|
// a custom UI in workbook ?
|
||||||
|
|
@ -72,7 +73,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationShip(
|
$this->writeRelationShip(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
5,
|
5,
|
||||||
'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility',
|
Namespaces::EXTENSIBILITY,
|
||||||
is_string($target) ? $target : ''
|
is_string($target) ? $target : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -102,13 +103,13 @@ class Rels extends WriterPart
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS);
|
||||||
|
|
||||||
// Relationship styles.xml
|
// Relationship styles.xml
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
1,
|
1,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
|
Namespaces::STYLES,
|
||||||
'styles.xml'
|
'styles.xml'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -116,7 +117,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
2,
|
2,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
|
Namespaces::THEME2,
|
||||||
'theme/theme1.xml'
|
'theme/theme1.xml'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -124,7 +125,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
3,
|
3,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
|
Namespaces::SHARED_STRINGS,
|
||||||
'sharedStrings.xml'
|
'sharedStrings.xml'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -134,7 +135,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
($i + 1 + 3),
|
($i + 1 + 3),
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
|
Namespaces::WORKSHEET,
|
||||||
'worksheets/sheet' . ($i + 1) . '.xml'
|
'worksheets/sheet' . ($i + 1) . '.xml'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +145,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationShip(
|
$this->writeRelationShip(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
($i + 1 + 3),
|
($i + 1 + 3),
|
||||||
'http://schemas.microsoft.com/office/2006/relationships/vbaProject',
|
Namespaces::VBA,
|
||||||
'vbaProject.bin'
|
'vbaProject.bin'
|
||||||
);
|
);
|
||||||
++$i; //increment i if needed for an another relation
|
++$i; //increment i if needed for an another relation
|
||||||
|
|
@ -183,7 +184,7 @@ class Rels extends WriterPart
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS);
|
||||||
|
|
||||||
// Write drawing relationships?
|
// Write drawing relationships?
|
||||||
$drawingOriginalIds = [];
|
$drawingOriginalIds = [];
|
||||||
|
|
@ -215,7 +216,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
$rId,
|
$rId,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
|
Namespaces::RELATIONSHIPS_DRAWING,
|
||||||
$relPath
|
$relPath
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +228,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
'_hyperlink_' . $i,
|
'_hyperlink_' . $i,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
|
Namespaces::HYPERLINK,
|
||||||
$hyperlink->getUrl(),
|
$hyperlink->getUrl(),
|
||||||
'External'
|
'External'
|
||||||
);
|
);
|
||||||
|
|
@ -242,14 +243,14 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
'_comments_vml' . $i,
|
'_comments_vml' . $i,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
|
Namespaces::VML,
|
||||||
'../drawings/vmlDrawing' . $worksheetId . '.vml'
|
'../drawings/vmlDrawing' . $worksheetId . '.vml'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
'_comments' . $i,
|
'_comments' . $i,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
|
Namespaces::COMMENTS,
|
||||||
'../comments' . $worksheetId . '.xml'
|
'../comments' . $worksheetId . '.xml'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +261,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
'_table_' . $i,
|
'_table_' . $i,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/table',
|
Namespaces::RELATIONSHIPS_TABLE,
|
||||||
'../tables/table' . $tableRef++ . '.xml'
|
'../tables/table' . $tableRef++ . '.xml'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -271,14 +272,14 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
'_headerfooter_vml' . $i,
|
'_headerfooter_vml' . $i,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
|
Namespaces::VML,
|
||||||
'../drawings/vmlDrawingHF' . $worksheetId . '.vml'
|
'../drawings/vmlDrawingHF' . $worksheetId . '.vml'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->writeUnparsedRelationship($worksheet, $objWriter, 'ctrlProps', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp');
|
$this->writeUnparsedRelationship($worksheet, $objWriter, 'ctrlProps', Namespaces::RELATIONSHIPS_CTRLPROP);
|
||||||
$this->writeUnparsedRelationship($worksheet, $objWriter, 'vmlDrawings', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing');
|
$this->writeUnparsedRelationship($worksheet, $objWriter, 'vmlDrawings', Namespaces::VML);
|
||||||
$this->writeUnparsedRelationship($worksheet, $objWriter, 'printerSettings', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings');
|
$this->writeUnparsedRelationship($worksheet, $objWriter, 'printerSettings', Namespaces::RELATIONSHIPS_PRINTER_SETTINGS);
|
||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
|
|
@ -325,7 +326,7 @@ class Rels extends WriterPart
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS);
|
||||||
|
|
||||||
// Loop through images and write relationships
|
// Loop through images and write relationships
|
||||||
$i = 1;
|
$i = 1;
|
||||||
|
|
@ -340,7 +341,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
$i,
|
$i,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
|
Namespaces::IMAGE,
|
||||||
'../media/' . $drawing->getIndexedFilename()
|
'../media/' . $drawing->getIndexedFilename()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -359,7 +360,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
$i++,
|
$i++,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
|
Namespaces::RELATIONSHIPS_CHART,
|
||||||
'../charts/chart' . ++$chartRef . '.xml'
|
'../charts/chart' . ++$chartRef . '.xml'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -391,7 +392,7 @@ class Rels extends WriterPart
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS);
|
||||||
|
|
||||||
// Loop through images and write relationships
|
// Loop through images and write relationships
|
||||||
foreach ($worksheet->getHeaderFooter()->getImages() as $key => $value) {
|
foreach ($worksheet->getHeaderFooter()->getImages() as $key => $value) {
|
||||||
|
|
@ -399,7 +400,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
$key,
|
$key,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
|
Namespaces::IMAGE,
|
||||||
'../media/' . $value->getIndexedFilename()
|
'../media/' . $value->getIndexedFilename()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -424,7 +425,7 @@ class Rels extends WriterPart
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS);
|
||||||
|
|
||||||
// Loop through images and write relationships
|
// Loop through images and write relationships
|
||||||
foreach ($worksheet->getComments() as $comment) {
|
foreach ($worksheet->getComments() as $comment) {
|
||||||
|
|
@ -436,7 +437,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
$bgImage->getImageIndex(),
|
$bgImage->getImageIndex(),
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
|
Namespaces::IMAGE,
|
||||||
'../media/' . $bgImage->getMediaFilename()
|
'../media/' . $bgImage->getMediaFilename()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +484,7 @@ class Rels extends WriterPart
|
||||||
$this->writeRelationship(
|
$this->writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
$i,
|
$i,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
|
Namespaces::HYPERLINK,
|
||||||
$drawing->getHyperlink()->getUrl(),
|
$drawing->getHyperlink()->getUrl(),
|
||||||
$drawing->getHyperlink()->getTypeHyperlink()
|
$drawing->getHyperlink()->getTypeHyperlink()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
||||||
|
|
@ -27,13 +28,13 @@ class RelsRibbon extends WriterPart
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS);
|
||||||
$localRels = $spreadsheet->getRibbonBinObjects('names');
|
$localRels = $spreadsheet->getRibbonBinObjects('names');
|
||||||
if (is_array($localRels)) {
|
if (is_array($localRels)) {
|
||||||
foreach ($localRels as $aId => $aTarget) {
|
foreach ($localRels as $aId => $aTarget) {
|
||||||
$objWriter->startElement('Relationship');
|
$objWriter->startElement('Relationship');
|
||||||
$objWriter->writeAttribute('Id', $aId);
|
$objWriter->writeAttribute('Id', $aId);
|
||||||
$objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image');
|
$objWriter->writeAttribute('Type', Namespaces::IMAGE);
|
||||||
$objWriter->writeAttribute('Target', $aTarget);
|
$objWriter->writeAttribute('Target', $aTarget);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
||||||
|
|
@ -27,10 +28,10 @@ class RelsVBA extends WriterPart
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS);
|
||||||
$objWriter->startElement('Relationship');
|
$objWriter->startElement('Relationship');
|
||||||
$objWriter->writeAttribute('Id', 'rId1');
|
$objWriter->writeAttribute('Id', 'rId1');
|
||||||
$objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature');
|
$objWriter->writeAttribute('Type', Namespaces::VBA_SIGNATURE);
|
||||||
$objWriter->writeAttribute('Target', 'vbaProjectSignature.bin');
|
$objWriter->writeAttribute('Target', 'vbaProjectSignature.bin');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
|
||||||
|
|
@ -5,28 +5,26 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||||
use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
|
use PhpOffice\PhpSpreadsheet\Chart\ChartColor;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
||||||
use PhpOffice\PhpSpreadsheet\RichText\Run;
|
use PhpOffice\PhpSpreadsheet\RichText\Run;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet as ActualWorksheet;
|
||||||
|
|
||||||
class StringTable extends WriterPart
|
class StringTable extends WriterPart
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create worksheet stringtable.
|
* Create worksheet stringtable.
|
||||||
*
|
*
|
||||||
* @param Worksheet $worksheet Worksheet
|
|
||||||
* @param string[] $existingTable Existing table to eventually merge with
|
* @param string[] $existingTable Existing table to eventually merge with
|
||||||
*
|
*
|
||||||
* @return string[] String table for worksheet
|
* @return string[] String table for worksheet
|
||||||
*/
|
*/
|
||||||
public function createStringTable(Worksheet $worksheet, $existingTable = null)
|
public function createStringTable(ActualWorksheet $worksheet, $existingTable = null)
|
||||||
{
|
{
|
||||||
// Create string lookup table
|
// Create string lookup table
|
||||||
$aStringTable = [];
|
$aStringTable = [];
|
||||||
$cellCollection = null;
|
|
||||||
$aFlippedStringTable = null; // For faster lookup
|
|
||||||
|
|
||||||
// Is an existing table given?
|
// Is an existing table given?
|
||||||
if (($existingTable !== null) && is_array($existingTable)) {
|
if (($existingTable !== null) && is_array($existingTable)) {
|
||||||
|
|
@ -85,7 +83,7 @@ class StringTable extends WriterPart
|
||||||
|
|
||||||
// String table
|
// String table
|
||||||
$objWriter->startElement('sst');
|
$objWriter->startElement('sst');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
$objWriter->writeAttribute('xmlns', Namespaces::MAIN);
|
||||||
$objWriter->writeAttribute('uniqueCount', (string) count($stringTable));
|
$objWriter->writeAttribute('uniqueCount', (string) count($stringTable));
|
||||||
|
|
||||||
// Loop through string table
|
// Loop through string table
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
@ -37,7 +38,7 @@ class Style extends WriterPart
|
||||||
// styleSheet
|
// styleSheet
|
||||||
$objWriter->startElement('styleSheet');
|
$objWriter->startElement('styleSheet');
|
||||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
$objWriter->writeAttribute('xmlns', Namespaces::MAIN);
|
||||||
|
|
||||||
// numFmts
|
// numFmts
|
||||||
$objWriter->startElement('numFmts');
|
$objWriter->startElement('numFmts');
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Table as WorksheetTable;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Table as WorksheetTable;
|
||||||
|
|
||||||
|
|
@ -34,7 +35,7 @@ class Table extends WriterPart
|
||||||
|
|
||||||
$objWriter->startElement('table');
|
$objWriter->startElement('table');
|
||||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
$objWriter->writeAttribute('xmlns', Namespaces::MAIN);
|
||||||
$objWriter->writeAttribute('id', (string) $tableRef);
|
$objWriter->writeAttribute('id', (string) $tableRef);
|
||||||
$objWriter->writeAttribute('name', $name);
|
$objWriter->writeAttribute('name', $name);
|
||||||
$objWriter->writeAttribute('displayName', $table->getName() ?: $name);
|
$objWriter->writeAttribute('displayName', $table->getName() ?: $name);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
||||||
|
|
@ -121,7 +122,7 @@ class Theme extends WriterPart
|
||||||
|
|
||||||
// a:theme
|
// a:theme
|
||||||
$objWriter->startElement('a:theme');
|
$objWriter->startElement('a:theme');
|
||||||
$objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
|
$objWriter->writeAttribute('xmlns:a', Namespaces::DRAWINGML);
|
||||||
$objWriter->writeAttribute('name', 'Office Theme');
|
$objWriter->writeAttribute('name', 'Office Theme');
|
||||||
|
|
||||||
// a:themeElements
|
// a:themeElements
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
|
@ -32,8 +33,8 @@ class Workbook extends WriterPart
|
||||||
// workbook
|
// workbook
|
||||||
$objWriter->startElement('workbook');
|
$objWriter->startElement('workbook');
|
||||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
$objWriter->writeAttribute('xmlns', Namespaces::MAIN);
|
||||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
$objWriter->writeAttribute('xmlns:r', Namespaces::SCHEMA_OFFICE_DOCUMENT);
|
||||||
|
|
||||||
// fileVersion
|
// fileVersion
|
||||||
$this->writeFileVersion($objWriter);
|
$this->writeFileVersion($objWriter);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
use PhpOffice\PhpSpreadsheet\Calculation\Information\ErrorValue;
|
use PhpOffice\PhpSpreadsheet\Calculation\Information\ErrorValue;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces;
|
||||||
use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
use PhpOffice\PhpSpreadsheet\RichText\RichText;
|
||||||
use PhpOffice\PhpSpreadsheet\Settings;
|
use PhpOffice\PhpSpreadsheet\Settings;
|
||||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||||
|
|
@ -41,15 +42,15 @@ class Worksheet extends WriterPart
|
||||||
// Worksheet
|
// Worksheet
|
||||||
$objWriter->startElement('worksheet');
|
$objWriter->startElement('worksheet');
|
||||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
$objWriter->writeAttribute('xmlns', Namespaces::MAIN);
|
||||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
$objWriter->writeAttribute('xmlns:r', Namespaces::SCHEMA_OFFICE_DOCUMENT);
|
||||||
|
|
||||||
$objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
|
$objWriter->writeAttribute('xmlns:xdr', Namespaces::SPREADSHEET_DRAWING);
|
||||||
$objWriter->writeAttribute('xmlns:x14', 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/main');
|
$objWriter->writeAttribute('xmlns:x14', Namespaces::DATA_VALIDATIONS1);
|
||||||
$objWriter->writeAttribute('xmlns:xm', 'http://schemas.microsoft.com/office/excel/2006/main');
|
$objWriter->writeAttribute('xmlns:xm', Namespaces::DATA_VALIDATIONS2);
|
||||||
$objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
|
$objWriter->writeAttribute('xmlns:mc', Namespaces::COMPATIBILITY);
|
||||||
$objWriter->writeAttribute('mc:Ignorable', 'x14ac');
|
$objWriter->writeAttribute('mc:Ignorable', 'x14ac');
|
||||||
$objWriter->writeAttribute('xmlns:x14ac', 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac');
|
$objWriter->writeAttribute('xmlns:x14ac', Namespaces::SPREADSHEETML_AC);
|
||||||
|
|
||||||
// sheetPr
|
// sheetPr
|
||||||
$this->writeSheetPr($objWriter, $worksheet);
|
$this->writeSheetPr($objWriter, $worksheet);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue