Пример #1
0
        protected override void ProcessParagraph(HWPFDocumentCore wordDocument, XmlElement parentElement, int currentTableLevel, Paragraph paragraph, string bulletText)
        {
            XmlElement pElement = htmlDocumentFacade.CreateParagraph();
            parentElement.AppendChild(pElement);

            StringBuilder style = new StringBuilder();
            WordToHtmlUtils.AddParagraphProperties(paragraph, style);

            int charRuns = paragraph.NumCharacterRuns;

            if (charRuns == 0)
            {
                return;
            }

            {
                String pFontName;
                int pFontSize;
                CharacterRun characterRun = paragraph.GetCharacterRun(0);
                if (characterRun != null)
                {
                    Triplet triplet = GetCharacterRunTriplet(characterRun);
                    pFontSize = characterRun.GetFontSize() / 2;
                    pFontName = triplet.fontName;
                    WordToHtmlUtils.AddFontFamily(pFontName, style);
                    WordToHtmlUtils.AddFontSize(pFontSize, style);
                }
                else
                {
                    pFontSize = -1;
                    pFontName = string.Empty;
                }
                blocksProperies.Push(new BlockProperies(pFontName, pFontSize));
            }
            try
            {
                if (!string.IsNullOrEmpty(bulletText))
                {
                    XmlText textNode = htmlDocumentFacade.CreateText(bulletText);
                    pElement.AppendChild(textNode);
                }

                ProcessCharacters(wordDocument, currentTableLevel, paragraph, pElement);
            }
            finally
            {
                blocksProperies.Pop();
            }

            if (style.Length > 0)
                htmlDocumentFacade.AddStyleClass(pElement, "p", style.ToString());

            WordToHtmlUtils.CompactSpans(pElement);
        }