"TextWriter sw" Formatting

0

I'm using the "TextWriter sw" to send to Word by turning the textboxes into doc the problem that I need some formatting. How do I set paragraph size, line spacing and etc ... The code I am using to send to Word is similar to the one below:

String strtxt22 = textBox7.Text;
String strtxt23 = textBox8.Text;
TextWriter sw = new StreamWriter(@"c:\Gold Business - Cadastro Funcionário.doc");
sw.WriteLine(strtxt22);
sw.WriteLine(strtxt23);
    
asked by anonymous 25.07.2016 / 14:06

1 answer

0

There is a package in Nuget called "DocX". It does exactly what you need.

Code sample:

var paraFormat = new Formatting();
paraFormat.FontFamily = new System.Drawing.FontFamily("Calibri");
paraFormat.Size = 10D;

 doc.InsertParagraph(headlineText, false, headLineFormat);
 doc.InsertParagraph(paraOne, false, paraFormat);

Source: Example taken from codeproject

    
25.07.2016 / 21:13