Saving Word Doc back to Web Server
http://www.theimagingsourceforums.com/showthread.php?t=317081
http://support.microsoft.com/kb/257757/ 服务器端 Office 自动化注意事项
http://msdn.microsoft.com/msdnmag/issues/06/11/BasicInstincts/default.aspx?loc=zh
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1174465&SiteID=1
http://blog.joycode.com/kaneboy/archive/2004/11/03/37889.aspx
http://blog.csdn.net/whchen/archive/2006/12/15/1444177.aspx
http://msdn.microsoft.com/msdnmag/issues/06/11/BasicInstincts/default.aspx?loc=zh在服务器端生成 Word 2007 文档
搜索 DSO Framer
找不到Word Object Library 11.0 重新安装VS 2005
在B/S中用DSO Framer OCX + Excel 解决复杂的报表问题
http://www.cnblogs.com/Dragonpro/archive/2006/12/01/228144.html
Developing Word Application using C# & DSO Framer
http://bbs.hidotnet.com/712/ShowPost.aspx
将Excel嵌入你的.Net程序2-使用dsoFramer
http://caidehui.cnblogs.com/archive/2006/04/19/378782.html
在Web页面上直接打开、编辑、创建Office文档 终于找到了
http://blog.joycode.com/kaneboy/archive/2004/11/03/37889.aspx
SAMPLE: FramerEx.exe 是 MDI ActiveX 文档容器示例用 VisualC++ 编写
http://support.microsoft.com/kb/268470/
Visual C++ ActiveX Control for hosting Office documents in Visual Basic or HTML
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q311/7/65.asp&NoWebContent=1#
用iframe
<iframe name="fraRead" frameborder="0" height="300" width="500" scrolling="auto" src="1.doc"></iframe>
C#操作Word文档(Office 2007)http://www.cnsdn.com.cn/blog/article.asp?id=1791
asp.net Word 操作 (比较全面)
http://blog.csdn.net/c_g1113/archive/2006/11/16/1388715.aspx
从ASP.NET得到Microsoft Word文档
http://supersand.cnblogs.com/archive/2005/11/09/272152.html
C#中如何保存文本为Word文件或Excel文件
http://www.cnblogs.com/phinecos/archive/2006/12/14/592635.html
用.net操作word
http://www.studycs.com/ShowArticle.aspx?id=9
Office Com AddIn 开发心得
http://mancini.cnblogs.com/archive/2005/03/28/120398.aspx
wp=new CCWordApp();
wp.OpenWithTemplate(Page.MapPath(“模版.doc“));
wp.InsertText(“aa“);
wp.GoToRightCharacter(14);
wp.InsertText(“bb“);
wp.GoToRightCell();
wp.GoToRightCell();
wp.InsertText(“cc“);
... 其余参阅CCWordApp类。
最上面漏了CCWordApp wp=null;
以下是CCWordApp类:
///
/// CCWordApp 的摘要说明。
///
public class CCWordApp
{
private Word.ApplicationClass oWordApplic;// a reference to Word application
private Word.Document oDoc;// a reference to the document
private object missing = System.Reflection.Missing.Value;
public CCWordApp() {
//
// TODO: 在此处添加构造函数逻辑
//
oWordApplic = new Word.ApplicationClass();
}
// Open a file (the file must exists) and activate it
public void Open( string strFileName)
{
object fileName = strFileName;
object readOnly = false;
object isVisible = true;
oDoc = oWordApplic.Documents.Open(ref fileName, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible,ref missing,ref missing,ref missing,ref missing);
oDoc.Activate();
}
//Open a new with template
public void OpenWithTemplate(string strFileName) {
object fileName = strFileName;
oDoc = oWordApplic.Documents.Add(ref fileName, ref missing,ref missing, ref missing);
oDoc.Activate();
}
// Open a new document
public void Open( )
{
oDoc = oWordApplic.Documents.Add(ref missing, ref missing,ref missing, ref missing);
oDoc.Activate();
}
public void Quit( )
{
oDoc.Close(ref missing,ref missing,ref missing);
oWordApplic.Quit(ref missing, ref missing, ref missing);
}
public void Save( )
{
oDoc.Save();
}
public void SaveAs(string strFileName )
{
object fileName = strFileName;
oDoc.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);
}
// Save the document in HTML format
public void SaveAsHtml(string strFileName )
{
object fileName = strFileName;
object Format = (int)Word.WdSaveFormat.wdFormatHTML;
oDoc.SaveAs(ref fileName, ref Format,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);
}
public void InsertText( string strText)
{
oWordApplic.Selection.TypeText(strText);
}
public void InsertLineBreak( )
{
oWordApplic.Selection.TypeParagraph();
}
public void InsertLineBreak( int nline)
{
//for (int i=0; i -------------------------------------------------------------------------------
}
public void InsertBookMark(string BookMark)
{
/* VB : With ActiveDocument.Bookmarks .Add
* Range:=Selection.Range,
* Name:="dq"
* .DefaultSorting = wdSortByName
* .ShowHidden = False End With
*/
object Range=oWordApplic.Selection.Range;
oWordApplic.ActiveDocument.Bookmarks.Add(BookMark,ref Range);
}
public void InsertPicture(string FileName)
{
/* VB : Selection.InlineShapes.AddPicture
* FileName:=zp,
* LinkToFile:=False,
* SaveWithDocument:=True
*/
object LinkToFile=false;
object SaveWithDocument=true;
oWordApplic.Selection.InlineShapes.AddPicture(FileName,ref LinkToFile,ref SaveWithDocument,ref missing);
}
// Go to a predefined bookmark, if the bookmark doesn’t exists the application will raise an error
public void GotoBookMark( string strBookMarkName)
{
// VB : Selection.GoTo What:=wdGoToBookmark, Name:="nome"
object Bookmark = (int)Word.WdGoToItem.wdGoToBookmark;
object NameBookMark = strBookMarkName;
oWordApplic.Selection.GoTo(ref Bookmark, ref missing, ref missing,ref NameBookMark);
}
public void GoToTheEnd( )
{
// VB : Selection.EndKey Unit:=wdStory
object unit ; unit = Word.WdUnits.wdStory ;
oWordApplic.Selection.EndKey ( ref unit, ref missing);
}
public void GoToTheBeginning( ) {
// VB : Selection.HomeKey Unit:=wdStory object unit ;
unit = Word.WdUnits.wdStory ;
oWordApplic.Selection.HomeKey ( ref unit, ref missing);
}
public void GoToTheTable(int ntable )
{
//Selection.GoTo What:=wdGoToTable, Which:=wdGoToFirst, Count:=1, Name:=""
// Selection.Find.ClearFormatting
// With Selection.Find
// .Text = ""
// .Replacement.Text = ""
// .Forward = True
// .Wrap = wdFindContinue
// .Format = False
// .MatchCase = False
// .MatchWholeWord = False
// .MatchWildcards = False
// .MatchSoundsLike = False
// .MatchAllWordForms = False
// End With
object what; what = Word.WdUnits.wdTable ;
object which; which = Word.WdGoToDirection.wdGoToFirst;
object count;
count = 1 ;
oWordApplic.Selection.GoTo( ref what, ref which, ref count, ref missing);
oWordApplic.Selection.Find.ClearFormatting(); oWordApplic.Selection.Text = "";
}
public void GoToRightCharacter( int Count)
{
// Selection.MoveRight Unit:=wdCharacter
object count=Count;
object direction;
direction = Word.WdUnits.wdCharacter;
oWordApplic.Selection.MoveRight(ref direction,ref count,ref missing);
}
public void GoToRightCharacterAndSelected( int Count,string Extend)
{
// Selection.MoveDown Unit:=wdLine, Count:=32, Extend:=wdExtend
object count=Count;
object extend=Extend;
object direction;
direction = Word.WdUnits.wdLine;
oWordApplic.Selection.MoveRight(ref direction,ref count,ref extend);
}
public void CopyNewTable()
{
/*VB: Selection.WholeStory Selection.Copy*/
//object Extend=Word.WdMovementType.wdExtend;
//object direction = Word.WdUnits.wdLine;
//oWordApplic.Selection.MoveDown(ref direction,ref count,ref Extend);
oWordApplic.Selection.WholeStory();
oWordApplic.Selection.Copy();
GoToTheBeginning();
}
public void GoToRightCell( )
{
// Selection.MoveRight Unit:=wdCell
object direction;
direction = Word.WdUnits.wdCell;
oWordApplic.Selection.MoveRight(ref direction,ref missing,ref missing);
} public void GoToLeftCell( )
{
// Selection.MoveRight Unit:=wdCell
object direction;
direction = Word.WdUnits.wdCell;
oWordApplic.Selection.MoveLeft(ref direction,ref missing,ref missing);
}
public void GoToDownCell( )
{
// Selection.MoveRight Unit:=wdCell
object direction;
direction = Word.WdUnits.wdLine;
oWordApplic.Selection.MoveDown(ref direction,ref missing,ref missing);
}
public void GoToUpCell( )
{
// Selection.MoveRight Unit:=wdCell
object direction;
direction = Word.WdUnits.wdLine;
oWordApplic.Selection.MoveUp(ref direction,ref missing,ref missing);
}
public void GoToUpCell(int Count )
{
// Selection.MoveRight Unit:=wdCell
object count=Count;
object direction;
direction = Word.WdUnits.wdLine;
oWordApplic.Selection.MoveUp(ref direction,ref count,ref missing);
}
// this function doesn’t work
public void InsertPageNumber( string strType, bool bHeader )
{
object alignment ;
object bFirstPage = false;
object bF = true;
//if (bHeader == true)
//WordApplic.Selection.HeaderFooter.PageNumbers.ShowFirstPageNumber = bF;
switch (strType)
{
case "Center":
alignment = Word.WdPageNumberAlignment.wdAlignPageNumberCenter;
//WordApplic.Selection.HeaderFooter.PageNumbers.Add(ref alignment,ref bFirstPage);
//Word.Selection objSelection = WordApplic.pSelection;
//oWordApplic.Selection.HeaderFooter.PageNumbers.Item(1).Alignment = Word.WdPageNumberAlignment.wdAlignPageNumberCenter;
break;
case "Right":
alignment = Word.WdPageNumberAlignment.wdAlignPageNumberRight;
//oWordApplic.Selection.HeaderFooter.PageNumbers.Item(1).Alignment = Word.WdPageNumberAlignment.wdAlignPageNumberRight;
break;
case "Left":
alignment = Word.WdPageNumberAlignment.wdAlignPageNumberLeft;
oWordApplic.Selection.HeaderFooter.PageNumbers.Add(ref alignment,ref bFirstPage);
break;
}
}
}
把上面两段合起来。至于其他的操作,可在word中先录制宏,再转成c#就行了。