i am using openxml.wordprocessing api to generate word.
my code is
paragraph p=new paragraph();
run r=new run()
text t=new text("Language :C#")
r.Append(t);
p.Append(r);
output is:
Language :C#.
but i want output like this
Language : c#
how to give this space (like \t in C programming) in text to get output like this. kindly reply
You must add the <w:tab/> tag between the runs (instead of '\t'):
using WP = DocumentFormat.OpenXml.Wordprocessing;
WP.TabChar tabChar = new WP.TabChar();
p.Append(tabChar);
You can easily fugure out such things yourself:
- first download and install Powertools for Open XML which will allow you to examine and analyze .docx files.
- when you don't know how Word formats certain constructs like the tab char you can create new Word document (with MS Word pplication) containing these constructs and save it to disk. Then you can analyze the document package in Visual Studio and this way you can find out how the construct was formatted/written into the file. All you have to do is to find the correct class in Open XML SDK library (in this case the class for 'w:tab' is 'TabChar')