Style Based On issue

May 3, 2011 at 11:03 AM


I have tried this on my Pc with Windows 7 and Word 2010 version 14.0.4760.1000 (32-bit), but get error for styles based on other styles.

If I comment out the "BasedOn" part in the WordMLtoWPF.xlst it works for me.



Style x:Key="{@w:styleId}">

<xsl:if test="$basedOn">





xsl:attribute name="BasedOn">

{StaticResource <xsl:value-of select="$basedOn"/>}







Anyone who can propose a better and more permanent fix?

When I look at the original transformed values in a text editor, I see:  "&#x:          ",  as part of the StaticResource value.

This is hidden in the xml-viewer, but are causing trouble for the XamlReader..







May 12, 2011 at 9:36 AM

After some more testing I got the same issue with other names too...

Replaced the temporary fix above with another temporary variant:

Added a call to this sub before reading the text into the XmlTextReader(txt, ...   but as this is not very efficient or optimal for large documents, I hope someone might can suggest a better fix...

        private string RemoveSpacesCausingError(string txt)
            txt = txt.Replace("&#xA;          ", "");
            txt = txt.Replace("&#xA;        ", "");
            return txt;