Microsoft.Office.Interop.Word 创建word

简介: Microsoft.Office.Interop.Word 创建word 转载:http://www.cnblogs.com/chenbg2001/archive/2010/03/14/1685746.html 功能总结或者完善。

Microsoft.Office.Interop.Word 创建word

转载:http://www.cnblogs.com/chenbg2001/archive/2010/03/14/1685746.html

功能总结或者完善。

一、添加页眉

using  System;  
using  System.Collections.Generic;  
using  System.ComponentModel;  
using  System.Data;  
using  System.Linq;  
using  System.Text;  
using  Word = Microsoft.Office.Interop.Word;  
using  System.IO;  
using  System.Reflection;  
using  Microsoft.Office.Interop.Word;  
  
  
namespace  WordCreateDLL  
{  
   public   class  AddHeader  
    {  
        public   static   void  AddSimpleHeader(Application WordApp, string  HeaderText)  
        {  
            //添加页眉   
            WordApp.ActiveWindow.View.Type = WdViewType.wdOutlineView;  
            WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryHeader;  
            WordApp.ActiveWindow.ActivePane.Selection.InsertAfter(HeaderText);  
            WordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft;//设置左对齐   
            WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument;  
        }  
        public   static   void  AddSimpleHeader(Application WordApp,  string  HeaderText, WdParagraphAlignment wdAlign)  
        {  
            //添加页眉   
            WordApp.ActiveWindow.View.Type = WdViewType.wdOutlineView;  
            WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryHeader;  
            WordApp.ActiveWindow.ActivePane.Selection.InsertAfter(HeaderText);  
            //WordApp.Selection.Font.Color = WdColor.wdColorDarkRed;//设置字体颜色   
            WordApp.Selection.ParagraphFormat.Alignment = wdAlign;//设置左对齐   
            WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument;  
        }  
        public   static   void  AddSimpleHeader(Application WordApp,  string  HeaderText, WdParagraphAlignment wdAlign,WdColor fontcolor, float  fontsize)  
        {  
            //添加页眉   
            WordApp.ActiveWindow.View.Type = WdViewType.wdOutlineView;  
            WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryHeader;  
            WordApp.ActiveWindow.ActivePane.Selection.InsertAfter(HeaderText);  
            WordApp.Selection.Font.Color =fontcolor;//设置字体颜色   
            WordApp.Selection.Font.Size = fontsize;//设置字体大小   
            WordApp.Selection.ParagraphFormat.Alignment = wdAlign;//设置对齐方式   
            WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument;  
        }  
  
  
    }  
}

 

using System;   
using System.Collections.Generic;   
using System.ComponentModel;   
using System.Data;   
using System.Linq;   
using System.Text;   
using Word = Microsoft.Office.Interop.Word;   
using System.IO;   
using System.Reflection;   
using Microsoft.Office.Interop.Word;   
namespace WordCreateDLL   
{ public class AddHeader { public static void  
AddSimpleHeader(Application WordApp,string HeaderText) { //添加页眉   
WordApp.ActiveWindow.View.Type = WdViewType.wdOutlineView;   
WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryHeader;   
WordApp.ActiveWindow.ActivePane.Selection.InsertAfter(HeaderText);   
WordApp.Selection.ParagraphFormat.Alignment =   
WdParagraphAlignment.wdAlignParagraphLeft;//设置左对齐   
WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument; }   
public static void AddSimpleHeader(Application WordApp, string  
HeaderText, WdParagraphAlignment wdAlign) { //添加页眉   
WordApp.ActiveWindow.View.Type = WdViewType.wdOutlineView;   
WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryHeader;   
WordApp.ActiveWindow.ActivePane.Selection.InsertAfter(HeaderText);   
//WordApp.Selection.Font.Color = WdColor.wdColorDarkRed;//设置字体颜色   
WordApp.Selection.ParagraphFormat.Alignment = wdAlign;//设置左对齐   
WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument; }   
public static void AddSimpleHeader(Application WordApp, string  
HeaderText, WdParagraphAlignment wdAlign,WdColor fontcolor,float  
fontsize) { //添加页眉 WordApp.ActiveWindow.View.Type =   
WdViewType.wdOutlineView; WordApp.ActiveWindow.View.SeekView =   
WdSeekView.wdSeekPrimaryHeader;   
WordApp.ActiveWindow.ActivePane.Selection.InsertAfter(HeaderText);   
WordApp.Selection.Font.Color =fontcolor;//设置字体颜色   
WordApp.Selection.Font.Size = fontsize;//设置字体大小   
WordApp.Selection.ParagraphFormat.Alignment = wdAlign;//设置对齐方式   
WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument; } }   
}

 

二、插入图片

 

using  System;  
using  System.Collections.Generic;  
using  System.ComponentModel;  
using  System.Data;  
using  System.Linq;  
using  System.Text;  
using  Word = Microsoft.Office.Interop.Word;  
using  System.IO;  
using  System.Reflection;  
using  Microsoft.Office.Interop.Word;  
  
namespace  WordCreateDLL  
{  
  public   class  AddPic  
    {  
      public   static   void  AddSimplePic(Document WordDoc,  string  FName,  float  Width,  float  Height,  object  An, WdWrapType wdWrapType)  
      {  
          //插入图片   
          string  FileName = @FName; //图片所在路径   
          object  LinkToFile =  false ;  
          object  SaveWithDocument =  true ;  
          object  Anchor = An;  
          WordDoc.Application.ActiveDocument.InlineShapes.AddPicture(FileName, ref  LinkToFile,  ref  SaveWithDocument,  ref  Anchor);  
          WordDoc.Application.ActiveDocument.InlineShapes[1].Width = Width;//图片宽度   
          WordDoc.Application.ActiveDocument.InlineShapes[1].Height = Height;//图片高度   
          //将图片设置为四周环绕型   
          Microsoft.Office.Interop.Word.Shape s = WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape();  
          s.WrapFormat.Type = wdWrapType;  
      }  
  
    }  
}

 

using  
System;   
using System.Collections.Generic;   
using System.ComponentModel;   
using System.Data;   
using System.Linq;   
using System.Text;   
using Word = Microsoft.Office.Interop.Word;   
using System.IO;   
using System.Reflection;   
using Microsoft.Office.Interop.Word;   
namespace WordCreateDLL   
{ public class AddPic { public static void AddSimplePic(Document   
WordDoc, string FName, float Width, float Height, object An, WdWrapType   
wdWrapType) { //插入图片 string FileName = @FName;//图片所在路径 object   
LinkToFile = false; object SaveWithDocument = true; object Anchor = An;   
WordDoc.Application.ActiveDocument.InlineShapes.AddPicture(FileName,   
ref LinkToFile, ref SaveWithDocument, ref Anchor);   
WordDoc.Application.ActiveDocument.InlineShapes[1].Width = Width;//图片宽度   
WordDoc.Application.ActiveDocument.InlineShapes[1].Height =   
Height;//图片高度 //将图片设置为四周环绕型 Microsoft.Office.Interop.Word.Shape s =   
WordDoc.Application.ActiveDocument.InlineShapes[1].ConvertToShape();   
s.WrapFormat.Type = wdWrapType; } }   
}

 

三、插入表格

 

using  System;  
using  System.Collections.Generic;  
using  System.ComponentModel;  
using  System.Data;  
using  System.Linq;  
using  System.Text;  
using  Word = Microsoft.Office.Interop.Word;  
using  System.IO;  
using  System.Reflection;  
using  Microsoft.Office.Interop.Word;  
  
namespace  WordCreateDLL  
{  
   public   class  AddTable  
    {  
       public   static   void  AddSimpleTable(Application WordApp, Document WordDoc,  int  numrows,  int  numcolumns, WdLineStyle outStyle, WdLineStyle intStyle)  
       {  
           Object Nothing = System.Reflection.Missing.Value;  
           //文档中创建表格   
           Microsoft.Office.Interop.Word.Table newTable = WordDoc.Tables.Add(WordApp.Selection.Range, numrows, numcolumns, ref  Nothing,  ref  Nothing);  
           //设置表格样式   
           newTable.Borders.OutsideLineStyle = outStyle;  
           newTable.Borders.InsideLineStyle = intStyle;  
           newTable.Columns[1].Width = 100f;  
           newTable.Columns[2].Width = 220f;  
           newTable.Columns[3].Width = 105f;  
  
           //填充表格内容   
           newTable.Cell(1, 1).Range.Text = "产品详细信息表" ;  
           newTable.Cell(1, 1).Range.Bold = 2;//设置单元格中字体为粗体   
           //合并单元格   
           newTable.Cell(1, 1).Merge(newTable.Cell(1, 3));  
           WordApp.Selection.Cells.VerticalAlignment =WdCellVerticalAlignment.wdCellAlignVerticalCenter;//垂直居中   
           WordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;//水平居中   
  
           //填充表格内容   
           newTable.Cell(2, 1).Range.Text = "产品基本信息" ;  
           newTable.Cell(2, 1).Range.Font.Color =WdColor.wdColorDarkBlue;//设置单元格内字体颜色   
           //合并单元格   
           newTable.Cell(2, 1).Merge(newTable.Cell(2, 3));  
           WordApp.Selection.Cells.VerticalAlignment =WdCellVerticalAlignment.wdCellAlignVerticalCenter;  
  
           //填充表格内容   
           newTable.Cell(3, 1).Range.Text = "品牌名称:" ;  
           newTable.Cell(3, 2).Range.Text = "品牌名称:" ;  
           //纵向合并单元格   
           newTable.Cell(3, 3).Select();//选中一行   
           object  moveUnit = WdUnits.wdLine;  
           object  moveCount = 5;  
           object  moveExtend = WdMovementType.wdExtend;  
           WordApp.Selection.MoveDown(ref  moveUnit,  ref  moveCount,  ref  moveExtend);  
           WordApp.Selection.Cells.Merge();  
  
  
           //插入图片   
           string  FileName = @ "C:\1.jpg" ; //图片所在路径   
           object  Anchor = WordDoc.Application.Selection.Range;  
           float  Width = 200f; //图片宽度   
           float  Height = 200f; //图片高度   
  
           //将图片设置为四周环绕型   
           WdWrapType wdWrapType = Microsoft.Office.Interop.Word.WdWrapType.wdWrapSquare;  
           AddPic.AddSimplePic(WordDoc, FileName, Width, Height, Anchor, wdWrapType);  
  
           newTable.Cell(12, 1).Range.Text = "产品特殊属性" ;  
           newTable.Cell(12, 1).Merge(newTable.Cell(12, 3));  
           //在表格中增加行   
           WordDoc.Content.Tables[1].Rows.Add(ref  Nothing);  
       }  
  
  
    }  
}

 

using  
System;   
using System.Collections.Generic;   
using System.ComponentModel;   
using System.Data;   
using System.Linq;   
using System.Text;   
using Word = Microsoft.Office.Interop.Word;   
using System.IO;   
using System.Reflection;   
using Microsoft.Office.Interop.Word;   
namespace WordCreateDLL   
{ public class AddTable { public static void AddSimpleTable(Application   
WordApp, Document WordDoc, int numrows, int numcolumns, WdLineStyle   
outStyle, WdLineStyle intStyle) { Object Nothing =   
System.Reflection.Missing.Value; //文档中创建表格   
Microsoft.Office.Interop.Word.Table newTable =   
WordDoc.Tables.Add(WordApp.Selection.Range, numrows, numcolumns, ref  
Nothing, ref Nothing); //设置表格样式 newTable.Borders.OutsideLineStyle =   
outStyle; newTable.Borders.InsideLineStyle = intStyle;   
newTable.Columns[1].Width = 100f; newTable.Columns[2].Width = 220f;   
newTable.Columns[3].Width = 105f; //填充表格内容 newTable.Cell(1,   
1).Range.Text = "产品详细信息表"; newTable.Cell(1, 1).Range.Bold =   
2;//设置单元格中字体为粗体 //合并单元格 newTable.Cell(1, 1).Merge(newTable.Cell(1, 3));   
WordApp.Selection.Cells.VerticalAlignment   
=WdCellVerticalAlignment.wdCellAlignVerticalCenter;//垂直居中   
WordApp.Selection.ParagraphFormat.Alignment =   
WdParagraphAlignment.wdAlignParagraphCenter;//水平居中 //填充表格内容   
newTable.Cell(2, 1).Range.Text = "产品基本信息"; newTable.Cell(2,   
1).Range.Font.Color =WdColor.wdColorDarkBlue;//设置单元格内字体颜色 //合并单元格   
newTable.Cell(2, 1).Merge(newTable.Cell(2, 3));   
WordApp.Selection.Cells.VerticalAlignment   
=WdCellVerticalAlignment.wdCellAlignVerticalCenter; //填充表格内容   
newTable.Cell(3, 1).Range.Text = "品牌名称:"; newTable.Cell(3,   
2).Range.Text = "品牌名称:"; //纵向合并单元格 newTable.Cell(3, 3).Select();//选中一行   
object moveUnit = WdUnits.wdLine; object moveCount = 5; object  
moveExtend = WdMovementType.wdExtend; WordApp.Selection.MoveDown(ref  
moveUnit, ref moveCount, ref moveExtend);   
WordApp.Selection.Cells.Merge(); //插入图片 string FileName =   
@"C:\1.jpg";//图片所在路径 object Anchor =   
WordDoc.Application.Selection.Range; float Width = 200f;//图片宽度 float   
Height = 200f;//图片高度 //将图片设置为四周环绕型 WdWrapType wdWrapType =   
Microsoft.Office.Interop.Word.WdWrapType.wdWrapSquare;   
AddPic.AddSimplePic(WordDoc, FileName, Width, Height, Anchor,   
wdWrapType); newTable.Cell(12, 1).Range.Text = "产品特殊属性";   
newTable.Cell(12, 1).Merge(newTable.Cell(12, 3)); //在表格中增加行   
WordDoc.Content.Tables[1].Rows.Add(ref Nothing); } }   
}

 

四、插入chart

using  System;  
using  System.Collections.Generic;  
using  System.ComponentModel;  
using  System.Data;  
using  System.Linq;  
using  System.Text;  
using  Word = Microsoft.Office.Interop.Word;  
using  System.IO;  
using  System.Reflection;  
using  Microsoft.Office.Interop.Word;  
using  Microsoft.Office.Interop.Graph;  
using  System.Windows.Forms;  
using  System.Drawing;  
  
  
namespace  WordCreateDLL  
{  
    public   class  AddChart  
    {  
        public   static   void  AddSimpleChart(Document WordDoc, Word.Application WordApp, Object oEndOfDoc,  string  [,]data)  
        {  
            //插入chart     
            object  oMissing = System.Reflection.Missing.Value;  
            Word.InlineShape oShape;  
            object  oClassType =  "MSGraph.Chart.8" ;  
            Word.Range wrdRng = WordDoc.Bookmarks.get_Item(ref  oEndOfDoc).Range;  
            oShape = wrdRng.InlineShapes.AddOLEObject(ref  oClassType,  ref  oMissing,  
                ref  oMissing,  ref  oMissing,  ref  oMissing,  
                ref  oMissing,  ref  oMissing,  ref  oMissing);  
  
            //Demonstrate use of late bound oChart and oChartApp objects to   
            //manipulate the chart object with MSGraph.   
            object  oChart;  
            object  oChartApp;  
            oChart = oShape.OLEFormat.Object;  
            oChartApp = oChart.GetType().InvokeMember("Application" ,BindingFlags.GetProperty,  null , oChart,  null );  
  
            //Change the chart type to Line.   
            object [] Parameters =  new  Object[1];  
            Parameters[0] = 4; //xlLine = 4   
            oChart.GetType().InvokeMember("ChartType" , BindingFlags.SetProperty,  
                null , oChart, Parameters);  
  
  
            Chart objChart = (Chart)oShape.OLEFormat.Object;  
            objChart.ChartType = XlChartType.xlColumnClustered;  
  
            //绑定数据   
            DataSheet dataSheet;  
            dataSheet = objChart.Application.DataSheet;  
            int  rownum=data.GetLength(0);  
            int  columnnum=data.GetLength(1);  
            for ( int  i=1;i<=rownum;i++ )  
                for  ( int  j = 1; j <= columnnum; j++)  
                {   
                   dataSheet.Cells[i,j] =data[i-1,j-1];  
       
                }  
            
            objChart.Application.Update();  
            oChartApp.GetType().InvokeMember("Update" ,  
                BindingFlags.InvokeMethod, null , oChartApp,  null );  
            oChartApp.GetType().InvokeMember("Quit" ,  
                BindingFlags.InvokeMethod, null , oChartApp,  null );  
  
            //设置大小   
            oShape.Width = WordApp.InchesToPoints(6.25f);  
            oShape.Height = WordApp.InchesToPoints(3.57f);  
  
        }  
    }  
}

 

 

using System;   
using System.Collections.Generic;   
using System.ComponentModel;   
using System.Data;   
using System.Linq;   
using System.Text;   
using Word = Microsoft.Office.Interop.Word;   
using System.IO;   
using System.Reflection;   
using Microsoft.Office.Interop.Word;   
using Microsoft.Office.Interop.Graph;   
using System.Windows.Forms;   
using System.Drawing;   
namespace WordCreateDLL   
{   
    public class AddChart   
    {   
        public static void AddSimpleChart(Document WordDoc, Word.Application WordApp, Object oEndOfDoc, string [,]data)   
        {   
            //插入chart     
            object oMissing = System.Reflection.Missing.Value;   
            Word.InlineShape oShape;   
            object oClassType = "MSGraph.Chart.8";   
            Word.Range wrdRng = WordDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;   
            oShape = wrdRng.InlineShapes.AddOLEObject(ref oClassType, ref oMissing,   
                ref oMissing, ref oMissing, ref oMissing,   
                ref oMissing, ref oMissing, ref oMissing);   
            //Demonstrate use of late bound oChart and oChartApp objects to   
            //manipulate the chart object with MSGraph.   
            object oChart;   
            object oChartApp;   
            oChart = oShape.OLEFormat.Object;   
            oChartApp = oChart.GetType().InvokeMember("Application",BindingFlags.GetProperty, null, oChart, null);   
            //Change the chart type to Line.   
            object[] Parameters = new Object[1];   
            Parameters[0] = 4; //xlLine = 4   
            oChart.GetType().InvokeMember("ChartType", BindingFlags.SetProperty,   
                null, oChart, Parameters);   
            Chart objChart = (Chart)oShape.OLEFormat.Object;   
            objChart.ChartType = XlChartType.xlColumnClustered;   
            //绑定数据   
            DataSheet dataSheet;   
            dataSheet = objChart.Application.DataSheet;   
            int rownum=data.GetLength(0);   
            int columnnum=data.GetLength(1);   
            for(int i=1;i<=rownum;i++ )   
                for (int j = 1; j <= columnnum; j++)   
                {    
                   dataSheet.Cells[i,j] =data[i-1,j-1];   
        
                }   
             
            objChart.Application.Update();   
            oChartApp.GetType().InvokeMember("Update",   
                BindingFlags.InvokeMethod, null, oChartApp, null);   
            oChartApp.GetType().InvokeMember("Quit",   
                BindingFlags.InvokeMethod, null, oChartApp, null);   
            //设置大小   
            oShape.Width = WordApp.InchesToPoints(6.25f);   
            oShape.Height = WordApp.InchesToPoints(3.57f);   
        }   
    }   
}

 

测试程序

 

private   void  button3_Click( object  sender, EventArgs e)  
       {  
  
  
           object  oMissing = System.Reflection.Missing.Value;  
           object  oEndOfDoc =  "\\endofdoc" ;  /* \endofdoc is a predefined bookmark */   
  
           //Start Word and create a new document.   
           Word.Application oWord;  
           Word.Document oDoc;  
           oWord = new  Word.Application();  
           oWord.Visible = true ;  
           oDoc = oWord.Documents.Add(ref  oMissing,  ref  oMissing,  
               ref  oMissing,  ref  oMissing);  
  
           ////添加页眉   
           String HeaderText = "石化盈科" ;  
          // AddHeader.AddSimpleHeader(oWord, HeaderText);   
           WdParagraphAlignment wdAlign = WdParagraphAlignment.wdAlignParagraphCenter;  
           WdColor fontcolor = WdColor.wdColorBlue;  
           float  fontsize = 10;  
           //AddHeader.AddSimpleHeader(oWord, HeaderText, wdAlign);   
           AddHeader.AddSimpleHeader(oWord, HeaderText, wdAlign,fontcolor,fontsize);  
  
           //Insert a paragraph at the beginning of the document.   
           Word.Paragraph oPara1;  
           oPara1 = oDoc.Content.Paragraphs.Add(ref  oMissing);  
           oPara1.Range.Text = "Heading 1" ;  
           oPara1.Range.Font.Bold = 1;  
           oPara1.Format.SpaceAfter = 24;    //24 pt spacing after paragraph.   
           oPara1.Range.InsertParagraphAfter();  
  
           //Insert a paragraph at the end of the document.   
           Word.Paragraph oPara2;  
           object  oRng = oDoc.Bookmarks.get_Item( ref  oEndOfDoc).Range;  
           oPara2 = oDoc.Content.Paragraphs.Add(ref  oRng);  
           oPara2.Range.Text = "Heading 2" ;  
           oPara2.Format.SpaceAfter = 6;  
           oPara2.Range.InsertParagraphAfter();  
  
           //插入文字   
           Word.Paragraph oPara3;  
           oRng = oDoc.Bookmarks.get_Item(ref  oEndOfDoc).Range;  
           oPara3 = oDoc.Content.Paragraphs.Add(ref  oRng);  
           oPara3.Range.Text = "This is a sentence of normal text. Now here is a table:" ;  
           oPara3.Range.Font.Bold = 0;  
           oPara3.Format.SpaceAfter = 24;  
           oPara3.Range.InsertParagraphAfter();  
  
           string  text =  "zhangruichao " ;  
           WdColor textcolor = fontcolor;  
           float  textsize = 12;  
           AddLine.AddSimpLine(oDoc, oEndOfDoc, oRng, text, textcolor, textsize);  
  
  
           //插入表格   
           WdLineStyle OutStyle = WdLineStyle.wdLineStyleThickThinLargeGap;  
           WdLineStyle InStyle = WdLineStyle.wdLineStyleSingle;  
           AddTable.AddSimpleTable(oWord, oDoc, 12, 3, OutStyle, InStyle);  
  
           //插入分页   
           Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref  oEndOfDoc).Range;  
           object  oCollapseEnd = Word.WdCollapseDirection.wdCollapseEnd;  
           object  oPageBreak = Word.WdBreakType.wdPageBreak;  
           wrdRng.Collapse(ref  oCollapseEnd);  
           wrdRng.InsertBreak(ref  oPageBreak);  
           wrdRng.Collapse(ref  oCollapseEnd);  
           wrdRng.InsertAfter("We're now on page 2. Here's my chart:" );  
           wrdRng.InsertParagraphAfter();  
  
           //Insert a chart.   
           string [,] data= new   string [4,5];  
  
           data[0,1] = "第一月" ;  
           data[0, 2] = "第二月" ;  
           data[0, 3] = "第三月" ;  
           data[0, 4] = "第四月" ;  
  
           data[1,0] = "东部" ;  
           data[1,1] = "50" ;  
           data[1,2] = "50" ;  
           data[1,3] = "40" ;  
           data[1,4] = "50" ;  
  
  
           data[2,0] = "西部" ;  
           data[2,1] = "60" ;  
           data[2,2] = "60" ;  
           data[2,3] = "70" ;  
           data[2,4] = "80" ;  
  
           //data[3,6] = "0";   
           data[3,0] = "中部" ;  
           data[3,1] = "50" ;  
           data[3,2] = "50" ;  
           data[3,3] = "40" ;  
           data[3,4] = "50" ;  
  
  
  
  
           AddChart.AddSimpleChart(oDoc, oWord, oEndOfDoc, data);  
  
           wrdRng = oDoc.Bookmarks.get_Item(ref  oEndOfDoc).Range;  
           wrdRng.InsertParagraphAfter();  
           wrdRng.InsertAfter("THE END." );  
  
           //Close this form.   
           this .Close();  
  
       }
目录
相关文章
|
9月前
|
前端开发 C#
C# 基于NPOI+Office COM组件 实现20行代码在线预览文档(word,excel,pdf,txt,png)
C# 基于NPOI+Office COM组件 实现20行代码在线预览文档(word,excel,pdf,txt,png)
|
1月前
|
Web App开发 JavaScript 前端开发
2024年纯前端VUE在线编辑微软Office/金山WPS的Word/Excel文档
现在,随着数字化进程渗透到到各行各业,数据安全已经成为了数字化革命中的重要组成部分,而在线Office成在OA、ERP、文档系统中得到了广泛的应用,为我国的信息化事业也做出了巨大贡献。随着操作系统、浏览器及Office软件的不断升级和更新换代,加上国家对信息化、数字化系统要求的不断提升,一些厂家的WebOffice控件产品不断被淘汰出局,而现存的几个产品也存在以下几个问题:
417 1
2024年纯前端VUE在线编辑微软Office/金山WPS的Word/Excel文档
|
3月前
|
前端开发
招投标系统是Electron的纯内网编辑Office Word,可以设置部分区域可编辑,其他的地方不能编辑吗?
我们是招投标系统的开发公司,框架是用的Electron,需要在纯内网的环境下编辑Office Word,可以设置部分区域可编辑,其他的地方不能编辑吗(如下红框位置)?并且在用户忘记填写一些区域的时候做提醒。
49 1
|
4月前
|
安全
猿大师办公助手网页在线安全浏览 Office Word 文档,只读打开 / 禁止编辑 / 禁止复制 / 禁止另存 / 禁止打印 / 禁止截屏
在企业 OA 系统或者在线协作办公场景中,有一些合同公文或者客户数据等重要文档需要我们在线共享给其他人,但是我们只希望其他人只能预览阅读文档,不能随便编辑修改文档,也禁止复制共享 Word 文档的内容到其他文档或者编辑器,不能将共享文件另存为本地文件夹,并且禁止用户打印该 Word 文档,那么该如何实现呢?
76 0
|
4月前
|
JSON 安全 数据安全/隐私保护
WebOffice 网页版在线 Office 的 Word 文档权限控制,限制编辑,只读、修订模式、禁止复制等
在一些在线 Office 文档中,有很多重要的文件需要保密控制,比如:报价单、客户资料等数据,只能给公司成员查看,但是不能编辑,并且不能拷贝,防止重要资料外泄。可以通过猿大师办公助手的在线 Office 的文档编辑权限来解决这些问题!
84 1
|
4月前
网页编辑Office Word文档,开启修订功能,启用留痕、显示留痕并接受留痕
在日常办公环境场景下,有时候会遇到帮助他人修改文档或者为文档提供修改意见,如果我们在文档中直接修改,其他人很不容易看到我们修改了哪个部分,如果一旦你的修改意见不被采纳,原作者还需要恢复原来的文档,这样为别人带来了更多的工作。 如果用猿大师办公助手在网页中编辑Office Word文档,开启修订功能,启用留痕、显示留痕并接受留痕,就可以很好的来解决此问题。
356 1
|
8月前
用bat删除 ms office word 近期记录
ord设置里面好像有个设置可以不显示,但当时忘百度查看怎么关了,就自己在注册表里删起来了。。。。。
78 0
|
9月前
|
Web App开发 JSON 前端开发
猿大师办公助手可实现微软Office Word文档在线安全预览,并且禁止编辑、拷贝、截屏、录屏、保存、导出、打印等!
现在,随着数字化进程渗透到到各行各业,数据安全已经成为了数字化革命中的重要组成部分,而在线Office成在OA、ERP、文档系统中得到了广泛的应用,为我国的信息化事业也做出了巨大贡献。随着操作系统、浏览器及Office软件的不断升级和更新换代,加上国家对信息化、数字化系统要求的不断提升,一些厂家的WebOffice控件产品不断被淘汰出局,而现存的几个产品也存在以下几个问题
320 0
|
11月前
|
XML 存储 安全
CVE-2022-30190 Follina Office RCE分析【附自定义word模板POC】
CVE-2022-30190 Follina Office RCE分析【附自定义word模板POC】
|
11月前
|
架构师 程序员 开发工具
【office办公软件】word 学习(一)
【office办公软件】word 学习(一)
68 0