Office open xml ms word : Autofit to content and Applying styles like classic etc

Traitée Office open xml ms word : Autofit to content and Applying styles like classic etc

  • vendredi 29 juin 2012 21:23
     
     

    Hello

    I am generating word document using office open xml sdk 2.0. I want to achieve following functionality.

    1) In a table that i generate dynamically from database i want to set column width to percentage that is returns from database. This works fine but if the width is smaller than content than it wraps. So if the column header is patient and width is 5% it displays

    pa in first row

    ti in second row

    ent in third row.

    If i do fit to content from ms word and it works fine. Is there a way to program this using office open xml? Like i want to set the percentage and use fit to content so that word is applied correctly.

    2) Secondly i want to set table styles to prebuilt styles in ms word. Like classic , light shading - accent 2 etc. How do it achieve that? I tried setting table style but it doesnt work.

Toutes les réponses