private void WriteFirstPage(string reportNum, string company, string reportDate) { m_wordApp.Selection.Font.Color = WdColor.wdColorBlack; m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; m_wordApp.Selection.Font.Bold = 0; m_wordApp.Selection.Font.Size = 20; m_wordApp.Selection.TypeText("合同编号:" + model.ProjectNumber); m_wordApp.Selection.Font.Bold = 5; m_wordApp.Selection.Font.Size = 40; // m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.TypeText("\r\n\r\n职业卫生技术服务合同"); //测试结束 m_wordApp.Selection.Font.Bold = 1; m_wordApp.Selection.Font.Size = 16; for (int i = 0; i < 7; ++i) { m_wordApp.Selection.TypeText("\r\n"); } m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; m_wordApp.Selection.TypeText("\r\n项目名称:" + model.CompaneName + "新建" + model.ProjectName + "建设项目职业病危害预评价"); m_wordApp.Selection.TypeText("\r\n委托方(甲方): "+ model.CompaneName); m_wordApp.Selection.TypeText("\r\n受托方(乙方): "+ "北京德康莱健康安全科技股份有限公司"); m_wordApp.Selection.TypeText("\r\n"); m_wordApp.Selection.TypeText("\r\n"); m_wordApp.Selection.TypeText("\r\n"); m_doc.Paragraphs.Add(); Word.Range range = m_doc.Paragraphs.First.Range; //Word.InlineShape shap = range.InlineShapes.AddPicture(@"NETofficeTest\NETofficeTest\bin\Debug\fv.png"); m_doc.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Header; m_doc.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Footer; m_wordApp.Selection.TypeText("\r\n"); Word.PageNumbers pns = m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers; pns.NumberStyle = WdPageNumberStyle.wdPageNumberStyleNumberInDash; pns.HeadingLevelForChapter = 0; pns.IncludeChapterNumber = false; pns.ChapterPageSeparator = WdSeparatorType.wdSeparatorHyphen; pns.RestartNumberingAtSection = false; pns.StartingNumber = 0; object pagenmbetal = WdPageNumberAlignment.wdAlignPageNumberRight; object first = true; m_wordApp.Selection.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); }
private void WriteFirstPage() { m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.Font.Bold = 5; m_wordApp.Selection.Font.Size = 25; // m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.TypeText("委 托 书"); m_wordApp.Selection.Font.Bold = 0; m_wordApp.Selection.Font.Size = 16; for (int i = 0; i < 2; ++i) { m_wordApp.Selection.TypeText("\r\n"); } m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; m_wordApp.Selection.TypeText("\r\n北京德康莱健康安全科技股份有限公司:"); m_wordApp.Selection.TypeText("\r\n根据《中华人民共和国职业病防治法》及国家相关规定的要求,现委托贵公司对我单位______________________工作场所___________工作。有关工作内容、费用、时限等,以双方签定的合同为准。"); for (int i = 0; i < 9; ++i) { m_wordApp.Selection.TypeText("\r\n"); } m_wordApp.Selection.Font.Bold = 0; m_wordApp.Selection.Font.Size = 16; m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; m_wordApp.Selection.TypeText("\r\n 年 月 日"); m_doc.Paragraphs.Add(); Word.Range range = m_doc.Paragraphs.First.Range; //Word.InlineShape shap = range.InlineShapes.AddPicture(@"NETofficeTest\NETofficeTest\bin\Debug\fv.png"); //m_doc.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Footer; m_wordApp.Selection.TypeText("\r\n"); Word.PageNumbers pns = m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers; pns.NumberStyle = WdPageNumberStyle.wdPageNumberStyleNumberInDash; pns.HeadingLevelForChapter = 0; pns.IncludeChapterNumber = false; pns.ChapterPageSeparator = WdSeparatorType.wdSeparatorHyphen; pns.RestartNumberingAtSection = false; pns.StartingNumber = 0; object pagenmbetal = WdPageNumberAlignment.wdAlignPageNumberRight; object first = true; m_wordApp.Selection.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); }
private void WriteFirstPage(string reportNum, string company, string reportDate) ///编号,公司名,日期 { m_wordApp.Selection.Font.Color = WdColor.wdColorBlack; ///颜色 m_wordApp.Selection.Font.Bold = 2; ///字体 m_wordApp.Selection.Font.Size = 24; ///字大小 m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.TypeText("\r\n北京德康莱健康安全科技股份有限公司"); m_wordApp.Selection.TypeParagraph(); m_wordApp.Selection.Font.Color = WdColor.wdColorBlack; m_wordApp.Selection.Font.Bold = 5; m_wordApp.Selection.Font.Size = 48; m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.TypeText("\r\n\r\n水质检测报告"); m_wordApp.Selection.Font.Bold = 1; m_wordApp.Selection.Font.Size = 16; for (int i = 0; i < 6; ++i) { m_wordApp.Selection.TypeText("\r\n"); } m_wordApp.Selection.TypeText("\r\n报告编号: " + reportNum); m_wordApp.Selection.TypeText("\r\n委托单位: " + company); m_wordApp.Selection.TypeText("\r\n受检单位: " + company); m_wordApp.Selection.TypeText("\r\n\r\n" + reportDate); m_wordApp.Selection.TypeText("\r\n"); m_doc.Paragraphs.Add(); Word.Range range = m_doc.Paragraphs.First.Range; m_doc.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Header; m_doc.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Footer; m_wordApp.Selection.TypeText("\r\n"); Word.PageNumbers pns = m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers; pns.NumberStyle = WdPageNumberStyle.wdPageNumberStyleNumberInDash; pns.HeadingLevelForChapter = 0; pns.IncludeChapterNumber = false; pns.ChapterPageSeparator = WdSeparatorType.wdSeparatorHyphen; pns.RestartNumberingAtSection = false; pns.StartingNumber = 0; object pagenmbetal = WdPageNumberAlignment.wdAlignPageNumberRight; object first = true; m_wordApp.Selection.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); }
private void WriteFirstPage(string reportNum, string company, string reportDate) { m_wordApp.Selection.Font.Color = WdColor.wdColorBlack; m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; m_wordApp.Selection.Font.Bold = 0; m_wordApp.Selection.Font.Size = 20; m_wordApp.Selection.TypeText("合同编号:" + model.ProjectNumber); m_wordApp.Selection.Font.Bold = 5; m_wordApp.Selection.Font.Size = 40; // m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.TypeText("\r\n\r\n职业卫生技术服务合同"); //测试结束 m_wordApp.Selection.Font.Bold = 1; m_wordApp.Selection.Font.Size = 16; for (int i = 0; i < 7; ++i) { m_wordApp.Selection.TypeText("\r\n"); } m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; m_wordApp.Selection.TypeText("\r\n项目名称: " + model.ProjectName); m_wordApp.Selection.TypeText("\r\n委托方(甲方): "+ model.CompaneName); m_wordApp.Selection.TypeText("\r\n受托方(乙方): "+ "北京德康莱健康安全科技股份有限公司"); //m_wordApp.Selection.TypeText("\r\n签订时间: " + model.ContractDate); //m_wordApp.Selection.TypeText("\r\n签订地点: " + company); //m_wordApp.Selection.TypeText("\r\n有效期限: " + company); m_wordApp.Selection.TypeText("\r\n"); m_doc.Paragraphs.Add(); Word.Range range = m_doc.Paragraphs.First.Range; //Word.InlineShape shap = range.InlineShapes.AddPicture(@"NETofficeTest\NETofficeTest\bin\Debug\fv.png"); m_doc.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Header; m_doc.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Footer; m_wordApp.Selection.TypeText("\r\n"); Word.PageNumbers pns = m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers; pns.NumberStyle = WdPageNumberStyle.wdPageNumberStyleNumberInDash; pns.HeadingLevelForChapter = 0; pns.IncludeChapterNumber = false; pns.ChapterPageSeparator = WdSeparatorType.wdSeparatorHyphen; pns.RestartNumberingAtSection = false; pns.StartingNumber = 0; object pagenmbetal = WdPageNumberAlignment.wdAlignPageNumberRight; object first = true; m_wordApp.Selection.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); // m_doc.ActiveWindow.View.SeekView = WdSeekView.wdSeekCurrentPageFooter;//转到页脚视图 //m_wordApp.Selection.Paragraphs.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; //整个页脚居中 // object page = WdFieldType.wdFieldPage; //当前页码 //m_wordApp.Selection.HeaderFooter.PageNumbers.RestartNumberingAtSection = true; // 重设起始页码 //m_wordApp.Selection.HeaderFooter.PageNumbers.StartingNumber = 1; //设为1 //m_wordApp.Selection.Fields.Add(m_wordApp.Selection.Range, page, 1, 1); // 加入 页码 字段 // object alignment = WdPageNumberAlignment.wdAlignPageNumberCenter; //页码居中,注意必须在加入页码以后才可以用,否则出现异常 //m_wordApp.Selection.HeaderFooter.PageNumbers[1].Alignment = WdPageNumberAlignment.wdAlignPageNumberCenter; //m_wordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument; //转到正文 }
private void WriteReportBasicInfo() { m_wordApp.Selection.Font.Size = 14; m_wordApp.Selection.Font.Bold = 1; m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.TypeText("检测与评价委托协议书\r"); m_wordApp.Selection.Font.Bold = 0; m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; m_wordApp.Selection.TypeText("协议编号:" + model.ProjectNumber); Word.Table basicInfo = m_doc.Tables.Add(m_wordApp.Selection.Range, 14, 4); basicInfo.Borders.Enable = 1; basicInfo.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleNone; basicInfo.Borders[WdBorderType.wdBorderTop].LineStyle = WdLineStyle.wdLineStyleSingle; basicInfo.Borders[WdBorderType.wdBorderBottom].LineStyle = WdLineStyle.wdLineStyleSingle; basicInfo.Columns[1].Width = 90; basicInfo.Rows[1].Height = 20; basicInfo.Cell(1, 1).Select(); SetCellHeaderText("委托单位名称"); // basicInfo.Cell(1, 2).Merge(basicInfo.Cell(1, 3)); basicInfo.Cell(1, 2).Select(); SetCellHeaderText(model.CompaneName); basicInfo.Cell(1, 3).Select(); SetCellHeaderText("委托时间"); basicInfo.Cell(1, 4).Select(); SetCellHeaderText(model.CreateTime.ToString("yyyy/MM/dd")); basicInfo.Rows[2].Height = 20; basicInfo.Cell(2, 1).Select(); SetCellHeaderText("委托单位地址"); basicInfo.Cell(2, 2).Select(); SetCellHeaderText(model.CompanyAddress); // basicInfo.Cell(2, 2).Merge(basicInfo.Cell(2, 3)); basicInfo.Cell(2, 3).Select(); SetCellHeaderText("电话/传真"); basicInfo.Cell(2, 4).Select(); SetCellHeaderText(model.ContactTel); basicInfo.Rows[3].Height = 20; basicInfo.Cell(3, 1).Select(); SetCellHeaderText("联系人"); // basicInfo.Cell(3, 2).Merge(basicInfo.Cell(3, 3)); basicInfo.Cell(3, 2).Select(); SetCellHeaderText(model.ContactPersonA); basicInfo.Cell(3, 3).Select(); SetCellHeaderText("联系电话"); basicInfo.Cell(3, 4).Select(); SetCellHeaderText(model.TelA); basicInfo.Rows[4].Height = 20; basicInfo.Cell(4, 1).Select(); SetCellHeaderText("承检单位名称"); basicInfo.Cell(4, 2).Merge(basicInfo.Cell(4, 4)); basicInfo.Cell(4, 2).Select(); SetCellHeaderText("北京德康莱健康安全科技股份有限公司"); basicInfo.Rows[5].Height = 20; basicInfo.Cell(5, 1).Select(); SetCellHeaderText("联系人"); // basicInfo.Cell(5, 2).Merge(basicInfo.Cell(5, 3)); basicInfo.Cell(5, 2).Select(); SetCellHeaderText(""); basicInfo.Cell(5, 3).Select(); SetCellHeaderText("联系电话"); basicInfo.Cell(5, 4).Select(); SetCellHeaderText(""); basicInfo.Rows[6].Height = 20; basicInfo.Cell(6, 1).Select(); SetCellHeaderText("检测类别"); basicInfo.Cell(6, 2).Merge(basicInfo.Cell(6, 4)); basicInfo.Cell(6, 2).Select(); SetCellHeaderText("检测项目"); basicInfo.Rows[7].Height = 20; basicInfo.Cell(7, 1).Select(); SetCellHeaderText("完成时间要求"); basicInfo.Cell(7, 2).Select(); m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; SetCellText(1, 12, "口 依据检测进度,无特殊要求(合同生效后__个工作日内) \r口 加急!(合同生效后在__个工作日内)\r口 ________________________", WdParagraphAlignment.wdAlignParagraphLeft, WdCellVerticalAlignment.wdCellAlignVerticalCenter); basicInfo.Cell(7, 2).Merge(basicInfo.Cell(7, 4)); basicInfo.Cell(8, 1).Merge(basicInfo.Cell(9, 1)); basicInfo.Cell(8, 1).Select(); SetCellHeaderText("取报告\r方式"); basicInfo.Cell(8, 2).Merge(basicInfo.Cell(9, 2)); basicInfo.Cell(8, 2).Select(); SetCellText(1, 12, "口 自取\r口 邮寄,报告交付日期以快递发送日邮戳为准", WdParagraphAlignment.wdAlignParagraphLeft, WdCellVerticalAlignment.wdCellAlignVerticalCenter); basicInfo.Cell(8, 3).Select(); SetCellHeaderText("报告收取人"); basicInfo.Cell(9, 3).Select(); SetCellHeaderText("邮 编"); basicInfo.Cell(9, 4).Select(); SetCellHeaderText(""); basicInfo.Cell(10, 1).Select(); //basicInfo.Rows[10].Height = 20; //basicInfo.Cell(10, 1).Select(); SetCellHeaderText("委托范围"); basicInfo.Cell(10, 2).Select(); SetCellText(1, 12, "口" + model.CompaneName + "工作场所职业病危害因素检测与评价\r口_______________", WdParagraphAlignment.wdAlignParagraphLeft, WdCellVerticalAlignment.wdCellAlignVerticalCenter); basicInfo.Cell(10, 2).Merge(basicInfo.Cell(10, 4)); //basicInfo.Rows[11].Height = 20; basicInfo.Cell(11, 1).Select(); SetCellHeaderText("付款方式"); basicInfo.Cell(11, 2).Select(); SetCellText(1, 11, "本协议总金额:" + model.Money + "(小写) (大写)\r本协议签订后五个工作日内支付" + model.PayRatioFirst + "%,即:" + ((Convert.ToDouble(model.Money)) * (Convert.ToDouble(model.PayRatioFirst) / 100)).ToString() + "元。 报告交付前" + (100 - Convert.ToInt16(model.PayRatioFirst)) + "%,即:" + ((Convert.ToDouble(model.Money)) * ((Convert.ToDouble(100) - Convert.ToDouble(model.PayRatioFirst)) / 100)).ToString("0.00") + "元。 \r开户行:兴业银行北京经济技术开发区\r账号:321130100100206456\r", WdParagraphAlignment.wdAlignParagraphLeft, WdCellVerticalAlignment.wdCellAlignVerticalCenter); basicInfo.Cell(11, 2).Merge(basicInfo.Cell(11, 4)); basicInfo.Cell(12, 1).Select(); SetCellHeaderText("协议说明"); basicInfo.Cell(12, 2).Select(); SetCellText(1, 12, "1.本协议书双方签字盖章之日起生效,本协议传真有效。\r2.承检单位在收到检测费全款后,按约定时间交付检测报告。\r3.本协议书一式四份,双方各持两份,具有同等法律效力。\r4.本协议未尽事宜,经双方友好协商解决;协商不成,以《中华人民共和国合同法》及相关法律法规为依据,双方均有保留向法院诉讼的权利。", WdParagraphAlignment.wdAlignParagraphLeft, WdCellVerticalAlignment.wdCellAlignVerticalCenter); basicInfo.Cell(12, 2).Merge(basicInfo.Cell(12, 4)); //basicInfo.Rows[13].Height = 20; basicInfo.Cell(13, 1).Select(); SetCellHeaderText("双方承诺"); basicInfo.Cell(13, 2).Select(); m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; SetCellText(1, 12, "委托单位承诺:\r1.按承检单位要求,提供工作场所工作环境、生产工艺、所用设备及防护设施、原辅材料及产品、工作方式及个体职业病防护等方面的相关资料,并保证所提供资料的真实性、完整性、客观性及与工作场所的一致性。\r2.在签订本协议书后 工作日内配合承检单位安排现场工作。\r3.委托单位未按照合同约定支付首付款的,承检单位有权拒绝赴现场工作,委托单位超过30日仍未支付首付款的,承检单位有权解除合同并要求委托方支付合同金额50%的违约金。承检单位完成检测与评价报告后,通知委托单位领取承检单位工作成果,委托单位应按照承检单位规定的时间接受承检单位的工作成果。委托单位无正当理由迟延接受超过30日的,视为委托单位已经接受承检单位的工作成果,委托单位仍应支付本合同剩余款项。\r承检单位承诺:\r1.按照国家法律、法规、标准和委托单位委托的范围开展检测与评价工作。\r2.若在收到检测费全款后未按本协议约定交付检测报告给委托单位的,承检单位每日按本协议总金额的0.5%支付违约金,直至本协议总金额的50%。", WdParagraphAlignment.wdAlignParagraphLeft, WdCellVerticalAlignment.wdCellAlignVerticalCenter); basicInfo.Cell(13, 2).Merge(basicInfo.Cell(13, 4)); m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; //basicInfo.Rows[14].Height = 20; basicInfo.Cell(14, 1).Select(); basicInfo.Cell(14, 1).Merge(basicInfo.Cell(14, 2)); SetCellText(1, 12, "□ 委托单位法人代表(签名):\r□ 或委托代理人(签名):\r\r\r委托单位: (盖章)\r 年 月 日 ", WdParagraphAlignment.wdAlignParagraphLeft, WdCellVerticalAlignment.wdCellAlignVerticalCenter); basicInfo.Cell(14, 2).Merge(basicInfo.Cell(14, 3)); basicInfo.Cell(14, 2).Select(); SetCellText(1, 12, "□ 承检单位法人代表(签名): \r□ 或委托代理人(签名): \r\r\r 承检单位: (盖章)\r 年 月 日", WdParagraphAlignment.wdAlignParagraphLeft, WdCellVerticalAlignment.wdCellAlignVerticalCenter); m_wordApp.Selection.MoveDown();//光标下移,光标移出表格 m_doc.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Header; m_doc.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Footer; Word.PageNumbers pns = m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers; pns.NumberStyle = WdPageNumberStyle.wdPageNumberStyleNumberInDash; pns.HeadingLevelForChapter = 0; pns.IncludeChapterNumber = false; pns.ChapterPageSeparator = WdSeparatorType.wdSeparatorHyphen; pns.RestartNumberingAtSection = false; pns.StartingNumber = 0; object pagenmbetal = WdPageNumberAlignment.wdAlignPageNumberRight; object first = true; m_wordApp.Selection.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); }
private void WriteFirstPage(Costing model) { m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.Font.Bold = 5; m_wordApp.Selection.Font.Size = 40; // m_wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; m_wordApp.Selection.TypeText("评价项目成本分析表"); //测试结束 Word.Table basicInfo = m_doc.Tables.Add(m_wordApp.Selection.Range, 23, 11); basicInfo.Borders.Enable = 1; basicInfo.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleNone; basicInfo.Borders[WdBorderType.wdBorderTop].LineStyle = WdLineStyle.wdLineStyleSingle; basicInfo.Borders[WdBorderType.wdBorderBottom].LineStyle = WdLineStyle.wdLineStyleSingle; basicInfo.Columns[1].Width = 90; basicInfo.Rows[1].Height = 20; basicInfo.Cell(1, 1).Merge(basicInfo.Cell(1, 11)); basicInfo.Cell(1, 1).Select(); SetCellHeaderText("基本信息"); basicInfo.Rows[2].Height = 20; basicInfo.Cell(2, 1).Merge(basicInfo.Cell(2, 3)); basicInfo.Cell(2, 1).Select(); SetCellHeaderText("项目名称"); basicInfo.Cell(2, 2).Merge(basicInfo.Cell(2, 6)); basicInfo.Cell(2, 2).Select(); SetCellHeaderText(model.ProjectName); basicInfo.Cell(2, 3).Select(); SetCellHeaderText("项目简称"); basicInfo.Cell(2, 4).Merge(basicInfo.Cell(2, 5)); basicInfo.Cell(2, 4).Select(); SetCellHeaderText(model.ProjectSynopsis); basicInfo.Rows[3].Height = 20; basicInfo.Cell(3, 1).Merge(basicInfo.Cell(3, 3)); basicInfo.Cell(3, 1).Select(); SetCellHeaderText("业务负责人"); basicInfo.Cell(3, 2).Merge(basicInfo.Cell(3, 6)); basicInfo.Cell(3, 2).Select(); SetCellHeaderText(""); basicInfo.Cell(3, 3).Select(); SetCellHeaderText("项目编号"); basicInfo.Cell(3, 4).Merge(basicInfo.Cell(3, 5)); basicInfo.Cell(3, 4).Select(); SetCellHeaderText(""); basicInfo.Rows[4].Height = 20; basicInfo.Cell(4, 1).Merge(basicInfo.Cell(4, 3)); basicInfo.Cell(4, 1).Select(); SetCellHeaderText("项目类型"); basicInfo.Cell(4, 2).Merge(basicInfo.Cell(4, 6)); basicInfo.Cell(4, 2).Select(); SetCellHeaderText(HYZK.FrameWork.Utility.EnumHelper.GetEnumTitle((EnumType)@Convert.ToInt32(model.Type))); basicInfo.Cell(4, 3).Select(); SetCellHeaderText("客户区县"); basicInfo.Cell(4, 4).Merge(basicInfo.Cell(4, 5)); basicInfo.Cell(4, 4).Select(); SetCellHeaderText(model.CustomerCounty); basicInfo.Rows[5].Height = 20; basicInfo.Cell(5, 1).Merge(basicInfo.Cell(5, 3)); basicInfo.Cell(5, 1).Select(); SetCellHeaderText("联系人"); basicInfo.Cell(5, 2).Merge(basicInfo.Cell(5, 6)); basicInfo.Cell(5, 2).Select(); SetCellHeaderText(model.ContactsPserson); basicInfo.Cell(5, 3).Select(); SetCellHeaderText("所属乡镇"); basicInfo.Cell(5, 4).Merge(basicInfo.Cell(5, 5)); basicInfo.Cell(5, 4).Select(); SetCellHeaderText(model.Towns); basicInfo.Rows[6].Height = 20; basicInfo.Cell(6, 1).Merge(basicInfo.Cell(6, 3)); basicInfo.Cell(6, 1).Select(); SetCellHeaderText("联系方式"); basicInfo.Cell(6, 2).Merge(basicInfo.Cell(6, 6)); basicInfo.Cell(6, 2).Select(); SetCellHeaderText(model.Relation); basicInfo.Cell(6, 3).Select(); SetCellHeaderText("备注"); basicInfo.Cell(6, 4).Merge(basicInfo.Cell(6, 5)); basicInfo.Cell(6, 4).Select(); SetCellHeaderText(model.Remark); basicInfo.Rows[7].Height = 20; basicInfo.Cell(7, 1).Merge(basicInfo.Cell(7, 11)); basicInfo.Cell(7, 1).Select(); SetCellHeaderText("项目利润分析"); basicInfo.Rows[8].Height = 20; basicInfo.Cell(8, 1).Select(); SetCellHeaderText(""); basicInfo.Cell(8, 2).Merge(basicInfo.Cell(8, 3)); basicInfo.Cell(8, 2).Select(); SetCellHeaderText("项目内容"); basicInfo.Cell(8, 3).Merge(basicInfo.Cell(8, 8)); basicInfo.Cell(8, 3).Select(); SetCellHeaderText("明细"); basicInfo.Cell(8, 4).Select(); SetCellHeaderText("金额(元)"); basicInfo.Cell(8, 5).Select(); SetCellHeaderText("备注"); basicInfo.Rows[9].Height = 20; basicInfo.Cell(9, 1).Select(); SetCellHeaderText("1"); basicInfo.Cell(9, 2).Merge(basicInfo.Cell(9, 3)); basicInfo.Cell(9, 2).Select(); SetCellHeaderText("销售额"); basicInfo.Cell(9, 3).Merge(basicInfo.Cell(9, 8)); basicInfo.Cell(9, 3).Select(); SetCellHeaderText(""); basicInfo.Cell(9, 4).Select(); SetCellHeaderText(model.Sales.ToString()); basicInfo.Cell(9, 5).Select(); SetCellHeaderText("备注"); basicInfo.Rows[10].Height = 20; basicInfo.Cell(10, 1).Select(); SetCellHeaderText("2"); basicInfo.Cell(10, 2).Merge(basicInfo.Cell(10, 3)); basicInfo.Cell(10, 2).Select(); SetCellHeaderText("技术成本"); basicInfo.Cell(10, 3).Merge(basicInfo.Cell(10, 4)); basicInfo.Cell(10, 3).Select(); SetCellHeaderText("咨询类型"); basicInfo.Cell(10, 4).Select(); SetCellHeaderText("所需工时"); basicInfo.Cell(10, 5).Select(); SetCellHeaderText("咨询单价"); basicInfo.Cell(10, 6).Select(); SetCellHeaderText("外聘专家数量"); basicInfo.Cell(10, 7).Select(); SetCellHeaderText("其他"); basicInfo.Cell(10, 8).Select(); SetCellHeaderText(""); basicInfo.Cell(10, 9).Select(); SetCellHeaderText(""); basicInfo.Rows[11].Height = 20; basicInfo.Cell(11, 1).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 2).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 3).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 4).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 5).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 6).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 7).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 8).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 9).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 10).Select(); SetCellHeaderText(""); basicInfo.Cell(11, 11).Select(); SetCellHeaderText(""); basicInfo.Rows[12].Height = 20; basicInfo.Cell(12, 1).Select(); SetCellHeaderText("3"); basicInfo.Cell(12, 2).Merge(basicInfo.Cell(12, 3)); basicInfo.Cell(12, 2).Select(); SetCellHeaderText("推广费(1)"); basicInfo.Cell(12, 3).Merge(basicInfo.Cell(12, 8)); basicInfo.Cell(12, 3).Select(); SetCellHeaderText("按实际发生"); basicInfo.Cell(12, 4).Select(); SetCellHeaderText(model.PromotionFee.ToString()); basicInfo.Cell(12, 5).Select(); SetCellHeaderText(""); basicInfo.Rows[13].Height = 20; basicInfo.Cell(13, 1).Select(); SetCellHeaderText("4"); basicInfo.Cell(13, 2).Merge(basicInfo.Cell(13, 3)); basicInfo.Cell(13, 2).Select(); SetCellHeaderText("推广费(2)"); basicInfo.Cell(13, 3).Merge(basicInfo.Cell(13, 8)); basicInfo.Cell(13, 3).Select(); SetCellHeaderText("按实际发生"); basicInfo.Cell(13, 4).Select(); SetCellHeaderText(""); basicInfo.Cell(13, 5).Select(); SetCellHeaderText(""); basicInfo.Rows[14].Height = 20; basicInfo.Cell(14, 1).Select(); SetCellHeaderText("5"); basicInfo.Cell(14, 2).Merge(basicInfo.Cell(14, 3)); basicInfo.Cell(14, 2).Select(); SetCellHeaderText("协作费"); basicInfo.Cell(14, 3).Merge(basicInfo.Cell(14, 8)); basicInfo.Cell(14, 3).Select(); SetCellHeaderText("(销售额-推广费)*15%"); basicInfo.Cell(14, 4).Select(); SetCellHeaderText(model.CollaborationFee.ToString()); basicInfo.Cell(14, 5).Select(); SetCellHeaderText(""); basicInfo.Rows[15].Height = 20; basicInfo.Cell(15, 1).Select(); SetCellHeaderText("6"); basicInfo.Cell(15, 2).Merge(basicInfo.Cell(15, 3)); basicInfo.Cell(15, 2).Select(); SetCellHeaderText("提成"); basicInfo.Cell(15, 3).Merge(basicInfo.Cell(15, 8)); basicInfo.Cell(15, 3).Select(); SetCellHeaderText("(销售额-推广费-协作费)*10%"); basicInfo.Cell(15, 4).Select(); SetCellHeaderText(model.Commission.ToString()); basicInfo.Cell(15, 5).Select(); SetCellHeaderText(""); basicInfo.Rows[16].Height = 20; basicInfo.Cell(16, 1).Select(); SetCellHeaderText("8"); basicInfo.Cell(16, 2).Merge(basicInfo.Cell(16, 3)); basicInfo.Cell(16, 2).Select(); SetCellHeaderText("其他费用"); basicInfo.Cell(16, 3).Merge(basicInfo.Cell(16, 8)); basicInfo.Cell(16, 3).Select(); SetCellHeaderText("实际发生费用"); basicInfo.Cell(16, 4).Select(); SetCellHeaderText(model.OtherFees.ToString()); basicInfo.Cell(16, 5).Select(); SetCellHeaderText(""); basicInfo.Rows[17].Height = 20; basicInfo.Cell(17, 1).Select(); SetCellHeaderText("9"); basicInfo.Cell(17, 2).Merge(basicInfo.Cell(17, 3)); basicInfo.Cell(17, 2).Select(); SetCellHeaderText("税金"); basicInfo.Cell(17, 3).Merge(basicInfo.Cell(17, 8)); basicInfo.Cell(17, 3).Select(); SetCellHeaderText("销售额/1.06*0.06"); basicInfo.Cell(17, 4).Select(); SetCellHeaderText(model.Tax.ToString()); basicInfo.Cell(17, 5).Select(); SetCellHeaderText(""); basicInfo.Rows[18].Height = 20; basicInfo.Cell(18, 1).Select(); SetCellHeaderText("10"); basicInfo.Cell(18, 2).Merge(basicInfo.Cell(18, 3)); basicInfo.Cell(18, 2).Select(); SetCellHeaderText("毛利润"); basicInfo.Cell(18, 3).Merge(basicInfo.Cell(18, 8)); basicInfo.Cell(18, 3).Select(); SetCellHeaderText("10=1-2-3-4-5-6-7-8-9"); basicInfo.Cell(18, 4).Select(); SetCellHeaderText(model.GrossProfit.ToString()); basicInfo.Cell(18, 5).Select(); SetCellHeaderText(""); basicInfo.Rows[19].Height = 20; basicInfo.Cell(19, 1).Select(); SetCellHeaderText("11"); basicInfo.Cell(19, 2).Merge(basicInfo.Cell(19, 3)); basicInfo.Cell(19, 2).Select(); SetCellHeaderText("毛利润率"); basicInfo.Cell(19, 3).Merge(basicInfo.Cell(19, 8)); basicInfo.Cell(19, 3).Select(); SetCellHeaderText("毛利润/销售额"); basicInfo.Cell(19, 4).Select(); SetCellHeaderText(model.GrossProfitMargin.ToString()); basicInfo.Cell(19, 5).Select(); SetCellHeaderText(""); basicInfo.Rows[20].Height = 20; basicInfo.Cell(20, 1).Merge(basicInfo.Cell(20, 11)); basicInfo.Cell(20, 1).Select(); SetCellHeaderText("审批签字栏"); basicInfo.Rows[21].Height = 20; basicInfo.Cell(21, 1).Merge(basicInfo.Cell(21, 2)); basicInfo.Cell(21, 1).Select(); SetCellHeaderText(""); basicInfo.Cell(21, 2).Merge(basicInfo.Cell(21, 3)); basicInfo.Cell(21, 2).Select(); SetCellHeaderText("签约人"); basicInfo.Cell(21, 3).Merge(basicInfo.Cell(21, 4)); basicInfo.Cell(21, 3).Select(); SetCellHeaderText("市场部"); basicInfo.Cell(21, 4).Merge(basicInfo.Cell(21, 5)); basicInfo.Cell(21, 4).Select(); SetCellHeaderText("副总经理"); basicInfo.Cell(21, 5).Merge(basicInfo.Cell(21, 6)); basicInfo.Cell(21, 5).Select(); SetCellHeaderText("总经理"); basicInfo.Cell(21, 6).Select(); SetCellHeaderText("其他"); basicInfo.Rows[22].Height = 20; basicInfo.Cell(22, 1).Merge(basicInfo.Cell(22, 2)); basicInfo.Cell(22, 1).Select(); SetCellHeaderText("签字栏"); basicInfo.Cell(22, 2).Merge(basicInfo.Cell(22, 3)); basicInfo.Cell(22, 2).Select(); SetCellHeaderText(""); basicInfo.Cell(22, 3).Merge(basicInfo.Cell(22, 4)); basicInfo.Cell(22, 3).Select(); SetCellHeaderText(""); basicInfo.Cell(22, 4).Merge(basicInfo.Cell(22, 5)); basicInfo.Cell(22, 4).Select(); SetCellHeaderText(""); basicInfo.Cell(22, 5).Merge(basicInfo.Cell(22, 6)); basicInfo.Cell(22, 5).Select(); SetCellHeaderText(""); basicInfo.Cell(22, 6).Select(); SetCellHeaderText(""); basicInfo.Rows[23].Height = 20; basicInfo.Cell(23, 1).Merge(basicInfo.Cell(23, 2)); basicInfo.Cell(23, 1).Select(); SetCellHeaderText("日期"); basicInfo.Cell(23, 2).Merge(basicInfo.Cell(23, 3)); basicInfo.Cell(23, 2).Select(); SetCellHeaderText(""); basicInfo.Cell(23, 3).Merge(basicInfo.Cell(23, 4)); basicInfo.Cell(23, 3).Select(); SetCellHeaderText(""); basicInfo.Cell(23, 4).Merge(basicInfo.Cell(23, 5)); basicInfo.Cell(23, 4).Select(); SetCellHeaderText(""); basicInfo.Cell(23, 5).Merge(basicInfo.Cell(23, 6)); basicInfo.Cell(23, 5).Select(); SetCellHeaderText(""); basicInfo.Cell(23, 6).Select(); SetCellHeaderText(""); m_wordApp.Selection.TypeText("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"); m_doc.Paragraphs.Add(); Word.Range range = m_doc.Paragraphs.First.Range; //Word.InlineShape shap = range.InlineShapes.AddPicture(@"NETofficeTest\NETofficeTest\bin\Debug\fv.png"); m_doc.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Header; m_doc.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = Footer; m_wordApp.Selection.TypeText("\r\n"); Word.PageNumbers pns = m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers; pns.NumberStyle = WdPageNumberStyle.wdPageNumberStyleNumberInDash; pns.HeadingLevelForChapter = 0; pns.IncludeChapterNumber = false; pns.ChapterPageSeparator = WdSeparatorType.wdSeparatorHyphen; pns.RestartNumberingAtSection = false; pns.StartingNumber = 0; object pagenmbetal = WdPageNumberAlignment.wdAlignPageNumberRight; object first = true; m_wordApp.Selection.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); m_wordApp.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers.Add(pagenmbetal, first); }