none
How to make format LeftItalicBold RRS feed

  • Question

  • Hi ,

    I am using OpenXml Format, now i want to set my text as LeftItalicBold , but not able to do?

     

    styleId="StyleLeftItalicBold"  or "StyleItalicBold"

    text="any thing"

    xmlContents.Append(CreateParagraph(styleId, text, keepNext));

     

    protected virtual string CreateParagraph(string styleId, string text, bool keepNext)

    {

     

    string paragraph = string.Empty;

     

    if (text == null)

    {

     

    return "<w:p/>";

    }

    paragraph =

    "<w:p>";

     

    if ((!String.IsNullOrEmpty(styleId) && styleId != "Default") || keepNext)

    {

    paragraph +=

    "<w:pPr>";

    paragraph +=

    "<w:pStyle w:val=\"" + styleId + "\"/>";

     

    if (keepNext)

    {

    paragraph +=

    "<w:keepNext/>";

    }

    paragraph +=

    "</w:pPr>";

    paragraph +=

    "<w:r><w:t>" + text + "</w:t></w:r>";

    }

     

    else

    {

    paragraph +=

    "<w:r><w:t>" + text + "</w:t></w:r>";

    }

    paragraph +=

    "</w:p>";

     

    return paragraph;

    }

    any idea??

    Thanks

     

    Monday, June 7, 2010 7:59 PM

Answers

  • Hi ashokapex,

    Thanks for your question.

    For your scenario, I suggest you using the Productivity Tool's "Compare Files" -> "See Part Diff" to see the generated sample code by the following steps:

    1.      Create an empty docx document, insert some texts and save it, such as “source.docx”.
    2.      Add the style you need to the texts and save the file as “target.docx”.
    3.      Open the Tool; click "Compare Files" to compare the “source.docx” and “target.docx” files.
    4.      In the "File Comparison" tab, click "View Part Diff" to show the differences between the selected two parts (in this case, we select “/word/document.xml”).
    5.      Click “View Part code” to see the complete sample code on how to apply a format on the texts.

    Hope this helps. If you have any question, please let me know.

    Thanks,

    Lu

    Tuesday, June 8, 2010 1:26 AM

All replies

  • Hi ashokapex,

    Thanks for your question.

    For your scenario, I suggest you using the Productivity Tool's "Compare Files" -> "See Part Diff" to see the generated sample code by the following steps:

    1.      Create an empty docx document, insert some texts and save it, such as “source.docx”.
    2.      Add the style you need to the texts and save the file as “target.docx”.
    3.      Open the Tool; click "Compare Files" to compare the “source.docx” and “target.docx” files.
    4.      In the "File Comparison" tab, click "View Part Diff" to show the differences between the selected two parts (in this case, we select “/word/document.xml”).
    5.      Click “View Part code” to see the complete sample code on how to apply a format on the texts.

    Hope this helps. If you have any question, please let me know.

    Thanks,

    Lu

    Tuesday, June 8, 2010 1:26 AM
  • Hi ,

     

    Productive tools is free version? from where i can get, i did see mywebex productive tools only.

     

    Thanks and Regards

    Tuesday, June 8, 2010 1:40 PM
  • Hi ashokapex,

    Sorry to provide the link in my last post. Yes, you could download the Tool from the same link of Open XML SDK: http://www.microsoft.com/downloads/details.aspx?FamilyID=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&displaylang=en.

    Thanks,

    Lu

    Wednesday, June 9, 2010 1:14 AM