把上图红色字体居中设置大小粗体,其余的不变,请各位大侠指点Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document document = wordApp.Documents.Add(ref none, ref none, ref none, ref none);
wordApp.Application.Selection.Font.Size=40;//用这句话设置字体,使整个文档的字体都是40
wordApp.Application.Selection.ParagraphFormat.Alignment=WdParagraphAlignment.wdAlignParagraphCenter;
wordApp.Application.Selection.TypeText(deviceName + "参数设置");
wordApp.Application.Selection.TypeParagraph();
Table table1 = document.Tables.Add(document.Paragraphs.Last.Range, 36, 6, ref none, ref none);
table1.Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphThaiJustify;//设置对其方式
table1.Borders.InsideLineStyle = WdLineStyle.wdLineStyleSingle;//设置表格边框样式
table1.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle;//设置表格边框样式C#word
Microsoft.Office.Interop.Word.Document document = wordApp.Documents.Add(ref none, ref none, ref none, ref none);
wordApp.Application.Selection.Font.Size=40;//用这句话设置字体,使整个文档的字体都是40
wordApp.Application.Selection.ParagraphFormat.Alignment=WdParagraphAlignment.wdAlignParagraphCenter;
wordApp.Application.Selection.TypeText(deviceName + "参数设置");
wordApp.Application.Selection.TypeParagraph();
Table table1 = document.Tables.Add(document.Paragraphs.Last.Range, 36, 6, ref none, ref none);
table1.Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphThaiJustify;//设置对其方式
table1.Borders.InsideLineStyle = WdLineStyle.wdLineStyleSingle;//设置表格边框样式
table1.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle;//设置表格边框样式C#word
这个我以前做过;
推荐用字符串堆表的方式,写;
就是网页的形式,html;
html的样式,word可以识别;
winform可以的,,
而且速度很快http://blog.csdn.net/happy09li/article/details/8637039
我这有js调用word.application的一些东西,希望对你有帮助var wrd=new ActiveXObject('Word.Application');
var doc=wrd.Documents.Add("",0,0,false);//两个0为word保存的类型为word默认类型;false是不打开word直接保存,如果打开,要注意WINWORD.exe进程问题
var Range=doc.Range();//得到整个文档编辑区域
Range.text = dept_MC+"日常信息统计\r\n";
Range.Font.Size=20;//设置此行字体为20
Range.Font.Name="宋体";
//Range.Font.spacing=40;//设置文字间宽度(空格)
Range.ParagraphFormat.Alignment=1;//1:居中,2:居右,3:居左