如何拆分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); c#问题??? 关于完整的文章的在数据库中的存储问题 求C#提取网页正文内容代码 关于联动省市菜单 关于sqlserver2005的问题,请各位来捧场,分不多别嫌弃啊 asp.net 写cookies问题 请问一下 用C#怎么在窗体上画一个椭圆? 大侠们给点源代码吧! .NET 4.0 和.NET 3.5框架更改后 有一段代码 编译出错了,求更改 都需要些什么文件啊 DataGrid的显示 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);