Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am saving labels data to word document but the document dont get good style on it the text is just under each other.
C#
object missing = Missing.Value;
      object start1 = 0;

      var wordApp = new ApplicationClass();

      Microsoft.Office.Interop.Word.Document myDoc = wordApp.Documents.Add(ref missing, ref missing,
      ref missing, ref missing);

      Range rng = myDoc.Range(ref start1, ref missing);

      try
      {
          object filename = @"C:\test1." + DropDownListDownloadCv0.SelectedItem.Text;


          myDoc.SaveAs(ref filename,
          ref missing, ref missing, ref missing, ref missing, ref missing,
          ref missing, ref missing, ref missing, ref missing, ref missing,
          ref missing,
          ref missing,
          ref missing, ref missing, ref missing);


          rng.InsertAfter(LabelPosition.Text + " " + LabelFirstName.Text + " " + LabelLastName.Text);

          rng.InsertAfter(lblbackground.Text);


is it possible to add style sheet or something to style the document because i want to use bold,float:left,float:Right Size on different labels and so an on my labels
Posted

1 solution

I would go into word and record when you are setting up a style, then use that as a template for doing it in Visual Studio
 
Share this answer
 
Comments
Kurac1 24-Apr-13 18:14pm    
Alright, could u maybe explaine a little more? Or maybe have à example?
Clifford Nelson 24-Apr-13 18:46pm    
To start, need to show the developer tab: http://msdn.microsoft.com/en-us/library/vstudio/bb608625.aspx. Should be able to search after that for help. Contact me if you cannot.
Kurac1 24-Apr-13 18:57pm    
Done that now

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900