none
First Bullet appers smaller then the others RRS feed

  • Question

  • 
    
    
    
    

    Hello,

    I am using DocumentFormat.OpenXml.dll to create a document file in which I am showing some HTML formatted data. When I tried to convert the Bullets HTML content data it shows the first bullet always small compare to others.refer following image.

    I am using following method to convert the Bulleted HTML to wordprocessing paragraph.

    private Paragraph GetParaEditor(string editorContentBlob, WordprocessingDocument myDoc, string altChnkId)
            {
                XNamespace w = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
                XNamespace r = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
    
                string html =
                 @"<html>
                           <head/>
                           <body>
                           {0}
                           </body>
                    </html>";
                System.Text.StringBuilder sbu = new System.Text.StringBuilder();
                html = sbu.AppendFormat(html, editorContentBlob).ToString();
                // html =  objEditorContent.ToString();
                string altChunkId = "AltChunkId" + icnt++;
    
                MainDocumentPart mainPart = myDoc.MainDocumentPart;
                AlternativeFormatImportPart chunk = mainPart.AddAlternativeFormatImportPart(
                    "application/xhtml+xml", altChunkId);
                using (Stream chunkStream = chunk.GetStream(FileMode.Create, FileAccess.Write))
                using (StreamWriter stringStream = new StreamWriter(chunkStream))
                    stringStream.Write(html);
                XElement altChunk = new XElement(w + "altChunk",
                    new XAttribute(r + "id", altChunkId)
                );
    
                AltChunk altChunck = new AltChunk();
                altChunck.Id = altChunkId;
    
                Paragraph paraEditor = new Paragraph();
                paraEditor.Append(new Run(altChunck));
                return paraEditor;
            }
    
    

     

    I am passing following HTML text to above method as editorContentBlob which returns me the paragraph.

    <ul><li>Test 1</li><li>Test 2</li><li>Test 3</li><li>Test 4</li></ul>

    Plese provide me solution for this issue. 

    Monday, December 28, 2015 1:43 PM

Answers

  • >>>I am using DocumentFormat.OpenXml.dll to create a document file in which I am showing some HTML formatted data. When I tried to convert the Bullets HTML content data it shows the first bullet always small compare to others.

    Word Version: 15.0.4779.1002
    According to your description, I have made a sample with your codes to try to reproduce your issue, unfortunately, I can't. You could refer to below result:

    So I suggest that you could run this application on another machine, or create a new document as simple as possible to make sure this issue can be reproduced.

    • Marked as answer by David_JunFeng Monday, January 11, 2016 3:03 PM
    Tuesday, December 29, 2015 7:37 AM