Пример #1
0
        //public static void HtmlPagesToDocx(string file, string imageDirectory, IEnumerable<BlogDemoorDetailData> pages, string footerText = null)
        //{
        //    OXmlDoc.Create(file, HtmlPagesToOXmlElements(pages.Select(page => DetailDataToHtmlPage(page)), imageDirectory, footerText));
        //}

        public static void HtmlPagesToDocx(string file, string imageDirectory, IEnumerable <HtmlPage> pages, string footerText = null)
        {
            //HtmlToOXmlElements_v2 htmlToOXmlElements = HtmlToOXmlElements_v2.Create(BlogDemoor_v4.GetConfigElement().zXPathElement("HtmlToDocx"), imageDirectory);
            HtmlToOXmlElements_v2 htmlToOXmlElements = CreateHtmlToOXmlElements(BlogDemoor_v4.GetConfigElement(), imageDirectory);

            OXmlDoc.Create(file, HtmlPagesToOXmlElements(htmlToOXmlElements, pages, footerText));
        }
Пример #2
0
        public static void Test_Trace_HtmlToOXml_v2(string file, string imageDirectory)
        {
            string traceFile = file + ".oxml.json";
            //HtmlToOXmlElements_v2.ToOXmlXElements(HtmlDocReader.ReadFile(file), imageDirectory).zSave(traceFile);
            //HtmlToOXmlElements_v2 htmlToOXmlElements = HtmlToOXmlElements_v2.Create(BlogDemoor_v4.GetConfigElement().zXPathElement("HtmlToDocx"), imageDirectory);
            HtmlToOXmlElements_v2 htmlToOXmlElements = CreateHtmlToOXmlElements(BlogDemoor_v4.GetConfigElement(), imageDirectory);

            htmlToOXmlElements.ToOXmlXElements(HtmlDocReader.ReadFile(file)).zSave(traceFile, jsonIndent: true);
        }
Пример #3
0
        public static void Test_HtmlToDocx(string file, string imageDirectory, string title = null, string footerText = null)
        {
            IEnumerable <OXmlElement> elements =
                GetDocDefaults().Union(
                    GetStyles()).Union(
                    GetDocSection()).Union(
                    GetHeaderFooter(footerText));

            if (title != null)
            {
                elements = elements.Union(GetTitle(title));
            }
            //HtmlToOXmlElements_v2 htmlToOXmlElements = HtmlToOXmlElements_v2.Create(BlogDemoor_v4.GetConfigElement().zXPathElement("HtmlToDocx"), imageDirectory);
            HtmlToOXmlElements_v2 htmlToOXmlElements = CreateHtmlToOXmlElements(BlogDemoor_v4.GetConfigElement(), imageDirectory);

            //elements = elements.Union(HtmlToOXmlElements_v2.ToOXmlXElements(HtmlDocReader.ReadFile(file), imageDirectory));
            elements = elements.Union(htmlToOXmlElements.ToOXmlXElements(HtmlDocReader.ReadFile(file)));
            OXmlDoc.Create(file + ".docx", elements);
        }