altChunk and Paragraph indention RRS feed

  • Question

  • Hi,

    I am trying to take a peice of Rich Text and insert it into a word document using the Open Office XML sdk 2.0 (etc..). I have been able to do this successfully using this code

    string altChunkId = string.Format("AltChunkID{0}", myIndex);

    AlternativeFormatImportPart chunk = myMainPart.AddAlternativeFormatImportPart(AlternativeFormatImportPartType.Xhtml, altChunkId);
    StringBuilder mySB = new StringBuilder();

    string myHTML = mySB.ToString();

    using (MemoryStream myMS = new MemoryStream(Encoding.UTF8.GetBytes(myHTML)))

    AltChunk myAltChunk = new AltChunk();
    myAltChunk.Id = altChunkId;

    When I then append the run with the altChunk as the text it all works beautifully... until I need to format the parargraph or the run that contains the altChunk. Unfortunately any and all formatting is just left out all together.

    Specifically I am looking to programatically insert this altChunk into the document and then indent that text based on where the text lies in a heirarchy....

    Any help on how to indent an altChunk????

    Sunday, February 26, 2012 11:48 PM