protected void B1(object s, EventArgs e)
{
if (FileUpload1.HasFile)
{
string FTSI = @"c:\temp\doc\";
string FP = folder_to_save_in + FileUpload1.FileName;
FileUpload1.SaveAs(FP);
Word.ApplicationClass wordApplication = new Word.ApplicationClass();
object oNO = System.Reflection.Missing.Value;
object oFP = FP;
Word.Document doc = wordApplication.Documents.Open(ref oFP,
ref oNO, ref oNO, ref oNO, ref oNO, ref oNO,
ref oNO, ref oNO, ref oNO, ref oNO, ref oNO,
ref oNO, ref oNO, ref oNO, ref oNO, ref oNO);
string newfilename = folder_to_save_in + FileUpload1.FileName.Replace(".doc", ".html");
object oNF = newfilename;
object oFR = Word.WdSaveFormat.wdFormatHTML;
object oEN = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8;
object oEN = Word.WdLineEndingType.wdCRLF;
wordApplication.ActiveDocument.SaveAs(ref oNF, ref oFR, ref oNO,
ref oNO, ref oNO, ref oNO, ref oNO, ref oNO, ref oNO,
ref oNO, ref oNO, ref oNO, ref oNO,
ref oNO, ref oNO, ref oNO);
Label1.Text = "Uploaded file successfully!";
doc.Close(ref oNO, ref oNO, ref oNO);
}
}
你說的是直接使用文檔嗎?請參閱[本](http://www.dq.winsila.com/tips-tricks/exploring-the-insides-of-a-docx-word-document.html)以開始使用。 – jonsca 2011-04-16 07:25:00
的Aspose詞能做到這一點,但它的成本錢。 – Magnus 2011-04-16 10:33:09