如何生成一个word或者Excel文件??

招RD和QA 2002-11-27 09:31:47
有没有这种例子,3ks.
...全文
27 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
houjiantao 2002-11-28
  • 打赏
  • 举报
回复
www.aspxcn.com

还有在你的在帮助文挡里也有的
songlian 2002-11-27
  • 打赏
  • 举报
回复
object oMissing = Missing.Value;
object filepath="E:\\测试报表32.doc";
object outputfile="E:\\reports\\测试报表32.ps";
object background= true;
object printtofile=true;
object unit = Word.WdUnits.wdStory;
object extend = Word.WdMovementType.wdMove;
string printerName = "IBM 4019 LaserPrinter PS39";
Word.Application oApp = new Word.Application();
oApp.Visible= true;
Word._Document oDoc=null;
try
{
oDoc = oApp.Documents.Open(ref filepath,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,
ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing);
oApp.Selection.EndKey(ref unit,ref extend);
oApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
oApp.Selection.Font.Size = 24;
oApp.Selection.Font.Bold = 1;
oApp.Selection.Font.Name = "宋体";
oApp.Selection.TypeText("测试报表");
oApp.ActivePrinter=printerName;
oDoc.PrintOut(ref background,ref oMissing,ref oMissing,ref outputfile,ref oMissing,ref oMissing,ref oMissing,ref oMissing,
ref oMissing,ref oMissing,ref printtofile,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,
ref oMissing);
//oDoc.prin
oDoc.Close(ref oMissing,ref oMissing,ref oMissing);
}
finally
{

oApp.Quit(ref oMissing,ref oMissing,ref oMissing);
}
这是我自己的一段关于Word打印的测试代码,希望对你有用
dy_2000_abc 2002-11-27
  • 打赏
  • 举报
回复
到google搜一下,这种例子很多。另外,vs.net带有一个操作word的例子

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧