private void createWord()
{
strFileName = System.Windows.Forms.Application.StartupPath + "test.doc";
if (System.IO.File.Exists((string)strFileName))
System.IO.File.Delete((string)strFileName);
Object Nothing = System.Reflection.Missing.Value;
myWordDoc = myWordApp.Documents.Add(ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing);
#region ????????ж????????д??word?????
strContent = "???nnr";
myWordDoc.Paragraphs.Last.Range.Text = strContent;
strContent = "??????????";
myWordDoc.Paragraphs.Last.Range.Text = strContent;
#endregion
//??WordDoc????????????????DOC???
myWordDoc.SaveAs(ref strFileName?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing?? ref Nothing);
//???WordDoc???????
myWordDoc.Close(ref Nothing?? ref Nothing?? ref Nothing);
//???WordApp???????
myWordApp.Quit(ref Nothing?? ref Nothing?? ref Nothing);
this.richTextBox1.Text = strFileName + "rn" + "???????";
}
private void openWord()
{
fontDialog1.ShowDialog();
System.Drawing.Font font = fontDialog1.Font;
object filepath = "D:asp.docx";
object ??Missing = System.Reflection.Missing.Value;
myWordDoc = myWordApp.Documents.Open(ref filepath?? ref oMissing?? ref oMissing?? ref oMissing?? ref oMissing??
ref oMissing?? ref oMissing?? ref oMissing?? ref oMissing?? ref oMissing?? ref oMissing??
ref oMissing?? ref oMissing?? ref oMissing?? ref oMissing?? ref oMissing);
myWordDoc.Content.Font.Size = font.Size;
myWordDoc.Content.Font.Name = font.Name;
myWordDoc.Save();
richTextBox1.Text = myWordDoc.Content.Text;
myWordDoc.Close(ref oMissing?? ref oMissing?? ref oMissing);
myWordApp.Quit(ref oMissing?? ref oMissing?? ref oMissing);
}
}