100分求助word2007相关开发文档 本人要做一个基于word2007的demo求助各位高手提供一些资料:比如插件开发,修改留痕(审批、审阅功能),域(控件)相关开发、的文档,基本上要实现以前WORD控件的功能。请大家给一些参考资料,谢谢。凡涉及到word开发文档,提供者都有分。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ASP .Net C# 下 Word开发资料2009年02月13日 星期五 下午 05:07Saving Word Doc back to Web Server http://www.theimagingsourceforums.com/showthread.php?t=317081http://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.aspxhttp://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终于找到了http://blog.joycode.com/kaneboy/archive/2004/11/03/37889.aspxSAMPLE: FramerEx.exe 是 MDI ActiveX 文档容器示例用 VisualC++ 编写http://support.microsoft.com/kb/268470/Visual C++ ActiveX Control for hosting Office documents in Visual Basic or HTMLhttp://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q311/7/65.asp&NoWebContent=1#Developing Word Application using C# & DSO Framer http://bbs.hidotnet.com/712/ShowPost.aspx将Excel嵌入你的.Net程序2-使用dsoFramerhttp://caidehui.cnblogs.com/archive/2006/04/19/378782.html在Web页面上直接打开、编辑、创建Office文档用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=1791asp.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.htmlC#中如何保存文本为Word文件或Excel文件 http://www.cnblogs.com/phinecos/archive/2006/12/14/592635.html用.net操作wordhttp://www.studycs.com/ShowArticle.aspx?id=9Office 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.Books .Add * Range:=Selection.Range, * Name:="dq" * .DefaultSorting = wdSortByName * .ShowHidden = False End With */ object Range=oWordApplic.Selection.Range; oWordApplic.ActiveDocument.Books.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 book, if the book doesn’t exists the application will raise an error public void GotoBookMark( string strBookMarkName) { // VB : Selection.GoTo What:=wdGoToBook, Name:="nome" object Book = (int)Word.WdGoToItem.wdGoToBook; object NameBookMark = strBookMarkName; oWordApplic.Selection.GoTo(ref Book, 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); } 把上面两段合起来。至于其他的操作,可在word中先录制宏,再转成c#就行了。 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; } } } http://download.csdn.net/source/192126 http://download.csdn.net/source/1917557 应用程序突然结束! Microsoft.Practices.EnterpriseLibrary.Data 2.0默认连接数是多少?我常超时 SelectSingleNode ASP.NET XML的小问题 请问如何将字符串转换为对应的byte[] 一个很简单的问题InputBox()这函数怎么用哈 一个小问题??? 在winform程序中如何关闭打开的系统软键盘 小问题 真是怪了!!!小弟的MDI子窗体设置了大小的最小值,可是还是能被任意变成0大小!!! 高分请教命名空间问题,类的引用问题!给50分 很熟悉vs2005的人进来~! 对象浏览器的BUG?
2009年02月13日 星期五 下午 05:07
Saving Word Doc back to Web Server
http://www.theimagingsourceforums.com/showthread.php?t=317081http://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
终于找到了
http://blog.joycode.com/kaneboy/archive/2004/11/03/37889.aspxSAMPLE: 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#Developing Word Application using C# & DSO Framer http://bbs.hidotnet.com/712/ShowPost.aspx
将Excel嵌入你的.Net程序2-使用dsoFramerhttp://caidehui.cnblogs.com/archive/2006/04/19/378782.html
在Web页面上直接打开、编辑、创建Office文档用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=1791asp.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.htmlC#中如何保存文本为Word文件或Excel文件
http://www.cnblogs.com/phinecos/archive/2006/12/14/592635.html
用.net操作word
http://www.studycs.com/ShowArticle.aspx?id=9Office 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.Books .Add
* Range:=Selection.Range,
* Name:="dq"
* .DefaultSorting = wdSortByName
* .ShowHidden = False End With
*/
object Range=oWordApplic.Selection.Range;
oWordApplic.ActiveDocument.Books.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 book, if the book doesn’t exists the application will raise an error
public void GotoBookMark( string strBookMarkName)
{
// VB : Selection.GoTo What:=wdGoToBook, Name:="nome"
object Book = (int)Word.WdGoToItem.wdGoToBook;
object NameBookMark = strBookMarkName;
oWordApplic.Selection.GoTo(ref Book, 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);
}
把上面两段合起来。至于其他的操作,可在word中先录制宏,再转成c#就行了。
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;
}
} }