資源簡(jiǎn)介
支持從WORD讀取數(shù)據(jù),向Word寫入表格,數(shù)據(jù)等,支持寫入到指定位置
代碼片段和文件信息
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(“請(qǐng)輸入方案編號(hào).“);
????????????????????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
評(píng)論
共有 條評(píng)論