c#生成word文档表格 各位有没有什么能使用c#生成word文档表格的技术阿~~或者在什么地方有帮助查询??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public void CreateTable(int Row ,int Col) { // Move to start of document. Object start = 0; Object end = 0; Word.Range rng = oDoc.Range(ref start, ref end); // Insert some text and paragraph s. rng.InsertBefore("Document Statistics"); rng.Font.Name = "Verdana"; rng.Font.Size = 16; rng.InsertParagraphAfter(); rng.InsertParagraphAfter(); rng.SetRange(rng.End, rng.End); // Add the table. Object defaultTableBehavior = Type.Missing; Object autoFitBehavior = Type.Missing; Word.Table tbl = rng.Tables.Add( rng, Row, Col, ref defaultTableBehavior, ref autoFitBehavior); // Format the table and apply a style. tbl.Range.Font.Size = 12; tbl.Columns.DistributeWidth(); // Object style = "Table Colorful 2"; // tbl.set_Style(ref style); // Insert text in cells. tbl.Cell(1,1).Range.Text = "Document Property"; tbl.Cell(1, 2).Range.Text = "value"; tbl.Cell(2, 1).Range.Text = "Number of Words"; tbl.Cell(2, 2).Range.Text = oDoc.Words.Count.ToString(); tbl.Cell(3, 1).Range.Text = "Number of Characters"; //tbl.Cell(1,1).Range .Paragraphs[1].Range .Text tbl.Cell(3, 2).Range.Text = oDoc.Characters.Count.ToString(); tbl.Select(); object oMissing = System.Reflection.Missing.Value; object a=true; object b=true; //定义位置 } 这位朋友说的是不是在printdocument中创建表格啊,这个问题是挺麻烦的。 求高人指导邮件管理系统(C#)。。。 在cmd命令行下,首先进入123.csproj所在的文件夹,然后敲了下面两条命令,生成两个exe文件,发现,两个exe文件是一样的。 求助,C#产生一个随机数的数组,不出现重复数字!! 一个关于OpenFileDialg的小问题 Bmp分割 类似 16*16 图标的类 毕业设计求助 弹出子窗体时隐藏父窗体 .net中分层架构 怎样在两个页面之间传递数据集? 如何得到TabControl中的当前TabPage的对象? Datagridview如何设定使某些column不能修改 [*119*]如何实现变量来定义类型???????
{
// Move to start of document.
Object start = 0;
Object end = 0;
Word.Range rng = oDoc.Range(ref start, ref end); // Insert some text and paragraph s.
rng.InsertBefore("Document Statistics");
rng.Font.Name = "Verdana";
rng.Font.Size = 16;
rng.InsertParagraphAfter();
rng.InsertParagraphAfter();
rng.SetRange(rng.End, rng.End); // Add the table.
Object defaultTableBehavior = Type.Missing;
Object autoFitBehavior = Type.Missing;
Word.Table tbl = rng.Tables.Add(
rng, Row, Col,
ref defaultTableBehavior, ref autoFitBehavior); // Format the table and apply a style.
tbl.Range.Font.Size = 12;
tbl.Columns.DistributeWidth();
// Object style = "Table Colorful 2";
// tbl.set_Style(ref style); // Insert text in cells.
tbl.Cell(1,1).Range.Text = "Document Property";
tbl.Cell(1, 2).Range.Text = "value";
tbl.Cell(2, 1).Range.Text = "Number of Words";
tbl.Cell(2, 2).Range.Text =
oDoc.Words.Count.ToString();
tbl.Cell(3, 1).Range.Text = "Number of Characters";
//tbl.Cell(1,1).Range .Paragraphs[1].Range .Text
tbl.Cell(3, 2).Range.Text =
oDoc.Characters.Count.ToString();
tbl.Select();
object oMissing = System.Reflection.Missing.Value;
object a=true;
object b=true;
//定义位置
}