C# word内容的设置 怎样用才C#设置纸张大小,页边距,页眉以及段后距的设置,代码要注释。谢谢!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 引用 using Microsoft.Office.Interop.Word;object missing = System.Reflection.Missing.Value; object Nothing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document wordDoc = new Document(); wordApp.Visible = true; wordDoc = wordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);if (cmbSize.Text == "A5") { wordDoc.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA5; wordDoc.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientLandscape; } else if (cmbSize.Text == "A4") { wordDoc.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA4; wordDoc.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientPortrait; } //wordApp.Selection.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientLandscape; object fileName = @"D:\test\" + DateTime.Now.ToShortDateString() + "\\" + txtTelephone.Text + " " + DateTime.Now.ToString().Replace(":", ";") + " .doc"; wordDoc.SaveAs(ref fileName, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing); windows server 2003 sp2 服务器 我发布网站在IIS中 出白页。求大神帮忙 关于WCF的EndPoint绑定问题 在不同计算机间使用消息队列发送消息必须要安装域服务器吗? AJAX发送JSON数据,如何解析? 数据库断开异常的处理 关于把EXCEL文件导入到SQLsever中!!在线等。。。 xml中动态添加节点的问题 从codeproject下载的源代码怎么打不开了? 关于数据库链接打开问题,求救 一道难题请教高手 C# 测试httpWebRequest的应用 关于WebBrowser禁用加载图片的一段C#代码
object Nothing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document wordDoc = new Document();
wordApp.Visible = true;
wordDoc = wordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);if (cmbSize.Text == "A5")
{
wordDoc.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA5;
wordDoc.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientLandscape;
}
else if (cmbSize.Text == "A4")
{
wordDoc.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA4;
wordDoc.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientPortrait;
} //wordApp.Selection.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientLandscape;
object fileName = @"D:\test\" + DateTime.Now.ToShortDateString() + "\\" + txtTelephone.Text + " " + DateTime.Now.ToString().Replace(":", ";") + " .doc";
wordDoc.SaveAs(ref fileName, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing);