diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php
index 7073c00d6a..eb6661b3de 100644
--- a/etemplate/inc/class.bo_merge.inc.php
+++ b/etemplate/inc/class.bo_merge.inc.php
@@ -377,13 +377,14 @@ abstract class bo_merge
);
// It seems easier to split the parent tags here
$replace_tags = array(
+ // Tables, lists don't go inside
'/<(ol|ul|table)( [^>]*)?>/' => '<$1$2>',
'/<\/(ol|ul|table)>/' => '$1>',
+ // Fix for things other than text (newlines) inside table row
+ '/<(td)( [^>]*)?>((?!))(.*?)<\/td>[\s]*?/' => '<$1$2>$4',
'/<(li)(.*?)>(.*?)<\/\1>/' => '<$1 $2>$3$1>',
-/*
- '/<(span)(.*?)>/' => "\n".'<$1$2>',
- '/<\/(span)>/' => '$1>'."\n",
-*/
+ // Remove extra whitespace
+ '/[\s]+(.*?)<\/w:t>/' => '$1'
);
$content = preg_replace(array_keys($replace_tags),array_values($replace_tags),$content);
//echo $content;die();
@@ -400,17 +401,18 @@ abstract class bo_merge
try
{
$element = new SimpleXMLelement($content);
- $content = $xslt->transformToXml($element);
+ $content = @$xslt->transformToXml($element);
- // Word 2003 needs invalid XML, add back in
- if($mimetype == 'application/xml' && $mso_application_progid == 'Word.Document') {
+ // Word 2003 needs two declarations, add extra declaration back in
+ if($mimetype == 'application/xml' && $mso_application_progid == 'Word.Document' && strpos($content, ''.$content;
}
// Validate
+ /*
$doc = new DOMDocument();
-// $doc->loadXML($content);
-// $doc->schemaValidate('/home/nathan/Downloads/WordprocessingML Schemas/wordnet.xsd');
-//echo $content;die();
+ $doc->loadXML($content);
+ $doc->schemaValidate(*Schema (xsd) file*);
+ */
}
catch (Exception $e)
{
diff --git a/etemplate/templates/default/msoffice.xslt b/etemplate/templates/default/msoffice.xslt
index be4b1ee6f2..ebee7ad9dc 100644
--- a/etemplate/templates/default/msoffice.xslt
+++ b/etemplate/templates/default/msoffice.xslt
@@ -86,7 +86,7 @@ Breakers
-->
-
+
@@ -221,7 +221,7 @@ Breakers
-
+
@@ -251,7 +251,13 @@ Breakers
-
+
+
+
+
+
+
+
diff --git a/etemplate/templates/default/wordml.xslt b/etemplate/templates/default/wordml.xslt
index 4587944459..15025c4255 100644
--- a/etemplate/templates/default/wordml.xslt
+++ b/etemplate/templates/default/wordml.xslt
@@ -87,7 +87,7 @@ Breakers
-->
-
+
@@ -123,6 +123,7 @@ Breakers
+
@@ -165,7 +166,7 @@ Breakers
-
+
@@ -218,8 +219,8 @@ Breakers
-
+
@@ -229,7 +230,15 @@ Breakers
-
+
+
+
+
+
+
+
+
+