当前位置: 首页 > news >正文

c# 通过界面上填写的信息输出到对应的word中,并另存为一个新的文件

c# 通过界面上填写的信息输出到对应的word中,并另存为一个新的文件
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using MSWord = Microsoft.Office.Interop.Word;
using System.IO;
using System.Runtime.InteropServices;
using System.Reflection;
using Microsoft.Office.Interop.Word;

namespace _10_输出房地一体资料
{
public partial class Form1 : Form
{

    public Form1(){InitializeComponent();bdcdyh.Text = "";zl.Text = "";qlrmc.Text = "";dhhm.Text = "";zjh.Text = "";zcs.Text = "3";zdmj.Text = "160.62";jzzdmj.Text = "160.62";jzmj.Text = "425.42";cwh.Text = "";szb.Text = "";szd.Text = "";szn.Text = "空地";szx.Text = "空地";txdz.Text = "";fwjg.Text = "钢筋混凝土";jgsj.Text = "2008年07月09日";zjsj.Text = "2008年07月09日";}private void button1_Click(object sender, EventArgs e){string bdcdyh1 = bdcdyh.Text;string zl1 = zl.Text;string qlrmc1 = qlrmc.Text;string dhhm1 = dhhm.Text;string zjh1 = zjh.Text;string zcs1 = zcs.Text;string zdmj1 = zdmj.Text;string jzzdmj1 = jzzdmj.Text;string jzmj1 = jzmj.Text;string cwh1 = cwh.Text;string szb1 = szb.Text;string szd1 = szd.Text;string szn1 = szn.Text;string szx1 = szx.Text;string txdz1 = txdz.Text;string fwjg1 = fwjg.Text;string jgsj1 = jgsj.Text;string zjsj1 = zjsj.Text;output_sqb(bdcdyh1, qlrmc1, zl1, dhhm1, zjh1, jgsj1, zdmj1);}private void output_sqb(string bdcdyh1, string qlrmc1, string zl1, string dhhm1, string zjh1, string jgsj1, string zdmj1){bdcdyh.Text = bdcdyh1 + "ye";object path;string strContent;MSWord.Application wordApp;MSWord.Document wordDoc;path = @"D:\2-python\10-精测房地数据转换程序\源代码\temp\updatefdyt\不动产调查登记申请表 - 副本.docx";wordApp = new MSWord.Application(); //初始化wordApp.Visible = false;//使文档可见Object Nothing = Missing.Value;wordDoc = wordApp.Documents.Add(path);var table = wordDoc.Tables[3] as Table;table.Cell(1,2).Range.Text = bdcdyh1.Substring(0,19);table.Cell(1,4).Range.Text = bdcdyh1.Substring(0, 19);table.Cell(2, 2).Range.Text = bdcdyh1;table.Cell(6, 4).Range.Text = dhhm1;table.Cell(11, 2).Range.Text = zl1;//写入权利人信息string[] list_qlrmc = qlrmc1.Split('、');string[] list_zjh = zjh1.Split('、');for (int i = 0; i < list_qlrmc.Length; i++){if (i == 4) break;if (i==0){table.Cell(3, 2).Range.Text = list_qlrmc[i];table.Cell(5, 4).Range.Text = list_zjh[i];}else{table.Cell(15 + i, 2).Range.Text = list_qlrmc[i];table.Cell(15 + i, 3).Range.Text = "个人";table.Cell(15 + i, 4).Range.Text = "身份证";table.Cell(15 + i, 5).Range.Text = list_zjh[i];}}table.Cell(21, 4).Range.Text = zdmj1;table.Cell(21, 6).Range.Text = jgsj1;wordDoc.SaveAs("D:\\2-python\\10-精测房地数据转换程序\\源代码\\temp\\updatefdyt\\Test.docx");wordApp.Quit();//bdcdyh.Text = str1;}private void button2_Click(object sender, EventArgs e){}private void dhhm_TextChanged(object sender, EventArgs e){}
}

}

http://www.lryc.cn/news/63126.html

相关文章:

  • HTML+CSS+JS 学习笔记(四)———jQuery
  • TryHackMe-Mnemonic(boot2root)
  • Nacos注册中心的使用
  • 项目中别用 “! = null“ 做判空了
  • MySQL数据库——MySQL子查询
  • 工具链和其他-超级好用的web调试工具whistle
  • ROS第四十三节——定位
  • 2023年第二十届五一数学建模竞赛题目 C题详细思路
  • 模块化编程原理示意图--CommonJS 模块编程--ES6 模块编程思路分析/图解--三种导出形式--全部代码示例
  • Ansys Zemax | 如何模拟双折射偏振器件
  • Java关键字之:this
  • 嵌入式Linux驱动开发(九)Linux中断
  • 数据库系统-并发控制
  • Java8 教程_编程入门自学教程_菜鸟教程-免费教程分享
  • 从零开始学架构——高可用存储架构
  • 连ChatGPT都不懂的五一调休,到底怎么来的?
  • AES工作流程
  • C++11
  • ubuntu18.04 配置zlmediakit 支持ffmpeg转码记录
  • H68K配置路由功能
  • *2.5 迭代法的收敛阶与加速收敛方法
  • 仪表板展示 | X-lab开放实验室GitHub开源项目洞察大屏
  • 【c语言】五大内存区域 | 堆区详解
  • 【JavaScript】动态表格
  • Css如何优雅的实现抽奖转盘
  • 在Java的小问题
  • HashMap的扩容机制、初始化容量大小的选择、容量为什么是2的次幂
  • [jenkins自动化2]: linux自动化部署方式之流水线(下篇)
  • idea使用 ( 二 ) 创建java项目
  • RabbitMq-接收消息+redis消费者重复接收