Exemplo n.º 1
0
        public static DocXmlDocument GetXmlDocument(string strXmlFilename, string strDocFilename)
        {
            Word03MLDocument doc = new Word03MLDocument();

            doc.Load(strXmlFilename);
            doc.GetNameSpaceURIs(doc.DocumentElement);
            doc.InitXPathExpressions();

            // get the full list of potential font and style names (these aren't what we'll present
            //  to the user, because we'll only show those that have some text, but just to get a
            //  full list that we won't have to a) requery or b) look beyond)
            doc.GetFullNameLists(strDocFilename);

            return(doc);
        }
Exemplo n.º 2
0
        public static DocXmlDocument GetXmlDocument(ref string strXmlFilename,
                                                    string strDocFilename, bool bSaveXmlOutputInFolder)
        {
            // when opening the xml file, let's do an xslt pass on it so we can
            //  merge all consecutive single-character runs into one. Word builds
            //  these (e.g. for multiple, consecutive Insert Symbol events), but we
            //  don't want them to be separate runs or we won't convert them as a
            //  block. And if we don't convert them as a block, then context effects
            //  (e.g. Greek final sigma) won't behave properly.
            string       strXSLT    = Properties.Resources.MergeSingleCharacterRunsWordML;
            MemoryStream streamXSLT = new MemoryStream(Encoding.UTF8.GetBytes(strXSLT));

#if DEBUG
            long lStartTime = DateTime.Now.Ticks;
#endif
            XmlReader xslReaderXSLT = XmlReader.Create(streamXSLT);

            XslCompiledTransform myProcessor  = new XslCompiledTransform();
            XsltSettings         xsltSettings = new XsltSettings {
                EnableScript = true
            };
            myProcessor.Load(xslReaderXSLT, xsltSettings, null);

            var doc = new Word03MLDocument();
            var strXsltOutputFilename = doc.GetOutputFileSpecForXmlFile(strDocFilename, bSaveXmlOutputInFolder);

            myProcessor.Transform(strXmlFilename, strXsltOutputFilename);
#if DEBUG
            long lDeltaTime = DateTime.Now.Ticks - lStartTime;
            System.Diagnostics.Debug.WriteLine(String.Format("Transform took: '{0}' ticks", lDeltaTime));
#endif

            strXmlFilename = strXsltOutputFilename;

            doc.HarvestFontsAndStylesUsedInAllText(strXmlFilename, strDocFilename);

            return(doc);
        }
Exemplo n.º 3
0
		public static DocXmlDocument GetXmlDocument(string strXmlFilename, string strDocFilename)
		{
			Word03MLDocument doc = new Word03MLDocument();
			doc.Load(strXmlFilename);
			doc.GetNameSpaceURIs(doc.DocumentElement);
			doc.InitXPathExpressions();

			// get the full list of potential font and style names (these aren't what we'll present
			//  to the user, because we'll only show those that have some text, but just to get a
			//  full list that we won't have to a) requery or b) look beyond)
			doc.GetFullNameLists(strDocFilename);

			return doc;
		}