• 大小: 68KB
    文件类型: .cs
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: C#
  • 标签: 读写  

资源简介

支持从WORD读取数据,向Word写入表格,数据等,支持写入到指定位置

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.xml;

namespace LaboratoryManagementUI.publics
{
    public partial class Fm_Create_Rep : Form
    {

        private List _li_v_demodata = null;
        public Fm_Create_Rep(List li)
        {
            _li_v_demodata = li;
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {

            if (radioButton1.Checked)
            {
                if (txt_No.Text == ““)
                {
                    MessageBox.Show(“请输入方案编号.“);
                    return;
                }
                if (_li_v_demodata[0].DemoNameName == “集中器“)
                {
                    System.Threading.Thread th = new System.Threading.Thread(Create3);
                    th.IsBackground = true;
                    th.Start(GetBook());
                }
                else
                {
                    System.Threading.Thread th = new System.Threading.Thread(Create);
                    th.IsBackground = true;
                    th.Start(GetBook());
                }


            }
            else
            {
                //获取书签
                System.Threading.Thread th = new System.Threading.Thread(Create2);
                th.IsBackground = true;
                th.Start(GetBook2());
                //开始生成

            }
            btn_save.Enabled = false;
            btn_close.Enabled = false;



        }

        /// 
        /// 获取书签信息
        /// 

        /// 
        private Dictionary GetBook()
        {
            StringBuilder code = new StringBuilder();
            bool ling = false;
            foreach (Model.v_DemoData item in _li_v_demodata)
            {
                if (ling)
                {
                    code.AppendLine(item.DemoCode.Trim());
                    ling = false;
                }
                else
                {
                    code.Append(item.DemoCode.Trim() + ““);
                    ling = true;
                }

            }

            int leng = 25;


            Dictionary Book = new Dictionary();
            Book.Add(“DemoGG“ SetStr(_li_v_demodata[0].StandardName));
            Book.Add(“DemoName“ SetStr(_li_v_demodata[0].DemoNameName));
            Book.Add(“DemoNo“ txt_No.Text);
            Book.Add(“DemoPCB“ SetStr(_li_v_demodata[0].DemoZBNO));
            Book.Add(“DemoPlan“ SetStr(_li_v_demodata[0].PlantName));
            Book.Add(“DemoPlan2“ SetStr(_li_v_demodata[0].PlantName));
            Book.Add(“DemoType“ SetStr(txt_jyfs.Text));
            Book.Add(“DemoXH“ Se

评论

共有 条评论