2013-04-23 54 views
1

我有用於在Microsoft Word文檔上打開和編寫文本的代碼。我如何使用C#編寫特殊定位的MS Word

private void button1_Click(object sender, EventArgs e) 
    { 


     Microsoft.Office.Interop.Word._Application oWord; 

     object oMissing = Type.Missing; 
     oWord = new Microsoft.Office.Interop.Word.Application(); 
     oWord.Visible = true; 



     oWord.Documents.Open("f:\\test.docx"); 
     oWord.Selection.TypeText("Write your text here"); 
    } 

我的問題是,我怎麼能寫在特殊格式化(位置,間距,對齊等)的文檔文件中的文本?

+0

通常你可以使用Range或Paragrapgh接口。看看他們的屬性。像Range.Font或Paragrapgh.TabIndent等。 – lavrik 2013-04-23 11:46:01

回答