Include styles.xml in Open Document, now it can be opened in KOffice, Gnumeric and OpenOffice.org.
This commit is contained in:
@@ -16,6 +16,9 @@ $Source$
|
|||||||
* libraries/export/odt.php, lang/*, libraries/config.default.php: Add Open
|
* libraries/export/odt.php, lang/*, libraries/config.default.php: Add Open
|
||||||
Document Text export (RFE #1068007).
|
Document Text export (RFE #1068007).
|
||||||
* libraries/opendocument.lib.php: Add document metainformation.
|
* libraries/opendocument.lib.php: Add document metainformation.
|
||||||
|
* libraries/opendocument.lib.php, libraries/export/ods.php,
|
||||||
|
libraries/export/odt.php: Include styles.xml in Open Document, now it
|
||||||
|
can be opened in KOffice, Gnumeric and OpenOffice.org.
|
||||||
|
|
||||||
2006-04-27 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
2006-04-27 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||||
* db_printview.php: fixed bug 'no tables found', refactored
|
* db_printview.php: fixed bug 'no tables found', refactored
|
||||||
|
@@ -61,10 +61,7 @@ function PMA_exportFooter() {
|
|||||||
*/
|
*/
|
||||||
function PMA_exportHeader() {
|
function PMA_exportHeader() {
|
||||||
$GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?' . '>'
|
$GLOBALS['ods_buffer'] .= '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?' . '>'
|
||||||
. '<office:document-content '
|
. '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
|
||||||
. 'xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" '
|
|
||||||
. 'xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" '
|
|
||||||
. 'xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0">'
|
|
||||||
. '<office:body>'
|
. '<office:body>'
|
||||||
. '<office:spreadsheet>';
|
. '<office:spreadsheet>';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -89,10 +89,7 @@ function PMA_exportFooter() {
|
|||||||
*/
|
*/
|
||||||
function PMA_exportHeader() {
|
function PMA_exportHeader() {
|
||||||
$GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?' . '>'
|
$GLOBALS['odt_buffer'] .= '<?xml version="1.0" encoding="' . $GLOBALS['charset'] . '"?' . '>'
|
||||||
. '<office:document-content '
|
. '<office:document-content '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
|
||||||
. 'xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" '
|
|
||||||
. 'xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" '
|
|
||||||
. 'xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0">'
|
|
||||||
. '<office:body>'
|
. '<office:body>'
|
||||||
. '<office:text>';
|
. '<office:text>';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -108,7 +105,7 @@ function PMA_exportHeader() {
|
|||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function PMA_exportDBHeader($db) {
|
function PMA_exportDBHeader($db) {
|
||||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="1" text:is-list-header="true">' . htmlspecialchars($GLOBALS['strDatabase'] . ' ' . $db) . '</text:h>';
|
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="1" text:style-name="Heading_1" text:is-list-header="true">' . htmlspecialchars($GLOBALS['strDatabase'] . ' ' . $db) . '</text:h>';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +160,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
|||||||
$field_flags[$j] = PMA_DBI_field_flags($result, $j);
|
$field_flags[$j] = PMA_DBI_field_flags($result, $j);
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:is-list-header="true">' . htmlspecialchars($GLOBALS['strDumpingData'] . ' ' . $table) . '</text:h>';
|
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars($GLOBALS['strDumpingData'] . ' ' . $table) . '</text:h>';
|
||||||
$GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_structure">';
|
$GLOBALS['odt_buffer'] .= '<table:table table:name="' . htmlspecialchars($table) . '_structure">';
|
||||||
$GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $fields_cnt . '"/>';
|
$GLOBALS['odt_buffer'] .= '<table:table-column table:number-columns-repeated="' . $fields_cnt . '"/>';
|
||||||
|
|
||||||
@@ -239,7 +236,7 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $do_relation = fals
|
|||||||
global $cfgRelation;
|
global $cfgRelation;
|
||||||
|
|
||||||
/* Heading */
|
/* Heading */
|
||||||
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:is-list-header="true">' . htmlspecialchars($GLOBALS['strTableStructure'] . ' ' . $table) . '</text:h>';
|
$GLOBALS['odt_buffer'] .= '<text:h text:outline-level="2" text:style-name="Heading_2" text:is-list-header="true">' . htmlspecialchars($GLOBALS['strTableStructure'] . ' ' . $table) . '</text:h>';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the unique keys in the table
|
* Get the unique keys in the table
|
||||||
|
@@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
require_once('./libraries/zip.lib.php');
|
require_once('./libraries/zip.lib.php');
|
||||||
|
|
||||||
|
$GLOBALS['OpenDocumentNS'] = 'xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" '
|
||||||
|
. 'xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" '
|
||||||
|
. 'xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" '
|
||||||
|
. 'xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" '
|
||||||
|
. 'xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" ';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimalistic creator of OASIS OpenDocument
|
* Minimalistic creator of OASIS OpenDocument
|
||||||
*
|
*
|
||||||
@@ -34,11 +40,56 @@ function PMA_createOpenDocument($mime, $data) {
|
|||||||
. '</office:meta>'
|
. '</office:meta>'
|
||||||
. '</office:document-meta>'
|
. '</office:document-meta>'
|
||||||
, 'meta.xml');
|
, 'meta.xml');
|
||||||
|
$zipfile -> addFile('<?xml version="1.0" encoding="UTF-8"?' . '>'
|
||||||
|
. '<office:document-styles '. $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">'
|
||||||
|
. '<office:font-face-decls>'
|
||||||
|
. '<style:font-face style:name="Arial Unicode MS" svg:font-family="\'Arial Unicode MS\'" style:font-pitch="variable"/>'
|
||||||
|
. '<style:font-face style:name="DejaVu Sans1" svg:font-family="\'DejaVu Sans\'" style:font-pitch="variable"/>'
|
||||||
|
. '<style:font-face style:name="HG Mincho Light J" svg:font-family="\'HG Mincho Light J\'" style:font-pitch="variable"/>'
|
||||||
|
. '<style:font-face style:name="DejaVu Serif" svg:font-family="\'DejaVu Serif\'" style:font-family-generic="roman" style:font-pitch="variable"/>'
|
||||||
|
. '<style:font-face style:name="Thorndale" svg:font-family="Thorndale" style:font-family-generic="roman" style:font-pitch="variable"/>'
|
||||||
|
. '<style:font-face style:name="DejaVu Sans" svg:font-family="\'DejaVu Sans\'" style:font-family-generic="swiss" style:font-pitch="variable"/>'
|
||||||
|
. '</office:font-face-decls>'
|
||||||
|
. '<office:styles>'
|
||||||
|
. '<style:default-style style:family="paragraph">'
|
||||||
|
. '<style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/>'
|
||||||
|
. '<style:text-properties style:use-window-font-color="true" style:font-name="DejaVu Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="DejaVu Sans1" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-name-complex="DejaVu Sans1" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>'
|
||||||
|
. '</style:default-style>'
|
||||||
|
. '<style:style style:name="Standard" style:family="paragraph" style:class="text"/>'
|
||||||
|
. '<style:style style:name="Text_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">'
|
||||||
|
. '<style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0835in"/>'
|
||||||
|
. '</style:style>'
|
||||||
|
. '<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_body" style:class="text">'
|
||||||
|
. '<style:paragraph-properties fo:margin-top="0.1665in" fo:margin-bottom="0.0835in" fo:keep-with-next="always"/>'
|
||||||
|
. '<style:text-properties style:font-name="DejaVu Sans" fo:font-size="14pt" style:font-name-asian="DejaVu Sans1" style:font-size-asian="14pt" style:font-name-complex="DejaVu Sans1" style:font-size-complex="14pt"/>'
|
||||||
|
. '</style:style>'
|
||||||
|
. '<style:style style:name="Heading_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_body" style:class="text" style:default-outline-level="1">'
|
||||||
|
. '<style:text-properties style:font-name="Thorndale" fo:font-size="24pt" fo:font-weight="bold" style:font-name-asian="HG Mincho Light J" style:font-size-asian="24pt" style:font-weight-asian="bold" style:font-name-complex="Arial Unicode MS" style:font-size-complex="24pt" style:font-weight-complex="bold"/>'
|
||||||
|
. '</style:style>'
|
||||||
|
. '<style:style style:name="Heading_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_body" style:class="text" style:default-outline-level="2">'
|
||||||
|
. '<style:text-properties style:font-name="DejaVu Serif" fo:font-size="18pt" fo:font-weight="bold" style:font-name-asian="DejaVu Sans1" style:font-size-asian="18pt" style:font-weight-asian="bold" style:font-name-complex="DejaVu Sans1" style:font-size-complex="18pt" style:font-weight-complex="bold"/>'
|
||||||
|
. '</style:style>'
|
||||||
|
. '</office:styles>'
|
||||||
|
. '<office:automatic-styles>'
|
||||||
|
. '<style:page-layout style:name="pm1">'
|
||||||
|
. '<style:page-layout-properties fo:page-width="8.2673in" fo:page-height="11.6925in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="1in" fo:margin-bottom="1in" fo:margin-left="1.25in" fo:margin-right="1.25in" style:writing-mode="lr-tb" style:footnote-max-height="0in">'
|
||||||
|
. '<style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>'
|
||||||
|
. '</style:page-layout-properties>'
|
||||||
|
. '<style:header-style/>'
|
||||||
|
. '<style:footer-style/>'
|
||||||
|
. '</style:page-layout>'
|
||||||
|
. '</office:automatic-styles>'
|
||||||
|
. '<office:master-styles>'
|
||||||
|
. '<style:master-page style:name="Standard" style:page-layout-name="pm1"/>'
|
||||||
|
. '</office:master-styles>'
|
||||||
|
. '</office:document-styles>'
|
||||||
|
, 'styles.xml');
|
||||||
$zipfile -> addFile('<?xml version="1.0" encoding="UTF-8"?' . '>'
|
$zipfile -> addFile('<?xml version="1.0" encoding="UTF-8"?' . '>'
|
||||||
. '<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">'
|
. '<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">'
|
||||||
. '<manifest:file-entry manifest:media-type="' . $mime . '" manifest:full-path="/"/>'
|
. '<manifest:file-entry manifest:media-type="' . $mime . '" manifest:full-path="/"/>'
|
||||||
. '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>'
|
. '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>'
|
||||||
. '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>'
|
. '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>'
|
||||||
|
. '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>'
|
||||||
. '</manifest:manifest>'
|
. '</manifest:manifest>'
|
||||||
, 'META-INF/manifest.xml');
|
, 'META-INF/manifest.xml');
|
||||||
return $zipfile -> file();
|
return $zipfile -> file();
|
||||||
|
Reference in New Issue
Block a user