Aspose.Words for .NET HTML代码直接产成WORD

Aspose.Words for .NET HTML代码直接生成WORD

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
 
//builder.MoveToBookmark("experiencetranslation");//如果设置了书签可以直接定位到书签处
builder.InsertHtml("<table>"                +
                   "<tr>"                   +
                   "<td>Row 1, Cell 1</td>" +
                   "<td>Row 1, Cell 2</td>" +
                   "</tr>"                  +
                   "<tr>"                   +
                   "<td>Row 2, Cell 2</td>" +
                   "<td>Row 2, Cell 2</td>" +
                   "</tr>"                  +
                   "</table>");
 
 doc.Save(MyDir + "DocumentBuilder.InsertTableFromHtml Out.doc");
// doc.Range.Bookmarks.Clear();//清除书签
//  doc.Save(DateTime.Now.ToString("yyyy-MM-dd") + ".doc", SaveFormat.Doc, SaveType.OpenInWord, Response); 
posted @ 2012-11-08 16:36  冰封的心  阅读(482)  评论(0)    收藏  举报