如何拆分word的表格。很急啊!!!!!!! 大家好。在word的工具里有个“绘制表格”。他是个画笔样的东西。现在程序里怎么调用呢。也就是说在指定位置拆分表格。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 告诉你一个简单的方法,在word的工具\宏菜单中,录制新宏。然后你在word中做拆分表格的操作,word会自动在宏中记录实现的脚本。这些脚本只要改动一下就可以在.net使用。 可以先创建一个表格using Word=Microsoft.Office.Interop.Word;Word.Application wordApp=newWord.ApplicationClass();Word.Document wordDoc=wordApp.Documents.Add(refNothing,refNothing,refNothing,refNothing);//设置文档宽度wordApp.Selection.PageSetup.LeftMargin=wordApp.CentimetersToPoints(float.Parse("2"));wordApp.ActiveWindow.ActivePane.HorizontalPercentScrolled=11;wordApp.Selection.PageSetup.RightMargin=wordApp.CentimetersToPoints(float.Parse("2"));//设置横向排版wordApp.Selection.PageSetup.Orientation=Word.WdOrientation.wdOrientLandscape; Object start=Type.Missing;Object end=Type.Missing;start=o;end=o;Word.Rangerng=wordDoc.Range(refstart,refend);rng.InsertBefore(strInfo);rng.SetRange(rng.End,rng.End)//创建16行7列的表格Word.Tabletbl=rng.Tables.Add(rng,16,7,refmissingValue,refmissingValue); tbl.Rows.HeightRule=Word.WdRowHeightRule.wdRowHeightAtLeast; tbl.Rows.Height=wordApp.CentimetersToPoints(float.Parse("0.8"));tbl.Range.Font.Size=9;tbl.Range.Font.Name="宋体";tbl.Range.Font.Bold=1; tbl.Range.ParagraphFormat.Alignment=Word.WdParagraphAlignment.wdAlignParagraphCenter; tbl.Range.Cells.VerticalAlignment=Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter; tbl.Borders.InsideLineWidth=Word.WdLineWidth.wdLineWidth150pt;......然后合并某些相邻的单元格tbl.Cell(1,1).Merge(tbl.Cell(2,1)); sorry,其中漏写和错些了int o = 0;object Nothing = System.Reflection.Missing.Value; object missing = System.Reflection.Missing.Value;object missingValue = Type.Missing; Word.Table tbl = rng.Tables.Add(rng, 16, 7, ref missingValue, ref missingValue); csdn 2012年度.NET最有价值问题评选第一名的问题 C#写web只能用asp.net.我想自己在服务器建立一个http通信服务这样可行吗? 困惑!!MDI(C#入门经典的一个问题) 谁有GZipStream 类压缩和解压缩字符串的列子 C#中怎么才能读取Access数据库中的所有表?(高手请进->>>) 关于[C#]接口中的简单问题 “该文件正由另一进程使用”,想了很久也不明白! 引用问题,请教。 Visio2003中UML不能正向工程到C#吗? DataGrid中的cell如何捆绑ComboBox XP启动时有个蓝屏,怎么取消掉? 请问何种在线编辑器好用?
然后你在word中做拆分表格的操作,word会自动在宏中记录实现的脚本。
这些脚本只要改动一下就可以在.net使用。
using Word=Microsoft.Office.Interop.Word;Word.Application wordApp=newWord.ApplicationClass();
Word.Document wordDoc=wordApp.Documents.Add(refNothing,refNothing,refNothing,refNothing);//设置文档宽度
wordApp.Selection.PageSetup.LeftMargin=wordApp.CentimetersToPoints(float.Parse("2"));
wordApp.ActiveWindow.ActivePane.HorizontalPercentScrolled=11;
wordApp.Selection.PageSetup.RightMargin=wordApp.CentimetersToPoints(float.Parse("2"));//设置横向排版
wordApp.Selection.PageSetup.Orientation=Word.WdOrientation.wdOrientLandscape;
Object start=Type.Missing;
Object end=Type.Missing;
start=o;
end=o;
Word.Rangerng=wordDoc.Range(refstart,refend);
rng.InsertBefore(strInfo);
rng.SetRange(rng.End,rng.End)//创建16行7列的表格
Word.Tabletbl=rng.Tables.Add(rng,16,7,refmissingValue,refmissingValue);
tbl.Rows.HeightRule=Word.WdRowHeightRule.wdRowHeightAtLeast;
tbl.Rows.Height=wordApp.CentimetersToPoints(float.Parse("0.8"));
tbl.Range.Font.Size=9;
tbl.Range.Font.Name="宋体";
tbl.Range.Font.Bold=1;
tbl.Range.ParagraphFormat.Alignment=Word.WdParagraphAlignment.wdAlignParagraphCenter;
tbl.Range.Cells.VerticalAlignment=Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
tbl.Borders.InsideLineWidth=Word.WdLineWidth.wdLineWidth150pt;
......然后合并某些相邻的单元格tbl.Cell(1,1).Merge(tbl.Cell(2,1));
object Nothing = System.Reflection.Missing.Value;
object missing = System.Reflection.Missing.Value;
object missingValue = Type.Missing;
Word.Table tbl = rng.Tables.Add(rng, 16, 7, ref missingValue, ref missingValue);