c# 根据CAD权籍数据的扩展属性,输出房地一体资料,申请表、审批表等
using System;
using System.Windows.Forms;
using MSWord = Microsoft.Office.Interop.Word;
using System.Runtime.InteropServices;
using System.Reflection;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using cadapp = Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using Autodesk.AutoCAD.Interop;
using System.Drawing;
using Autodesk.AutoCAD.Interop.Common;
using System.Collections.Generic;
using System.Linq;
namespace _10_输出房地一体资料
{
public partial class Form1 : Form
{文章来源:https://www.toymoban.com/news/detail-678126.html
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 MSWord.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)
{
AcadApplication app = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.23");
AcadDocument doc = app.ActiveDocument;
//Editor ed = cadapp.Core.Application.DocumentManager.MdiActiveDocument.Editor;
//PromptEntityOptions opt = new PromptEntityOptions("\n 请选择实体:");
//PromptEntityResult res = ed.GetEntity(opt);
//double[] spoint = { 0, 0, 0 };
//double[] epoint = { 0, 1000, 0 };
//doc.ModelSpace.AddLine(spoint, epoint);
//app.ZoomAll();
object returnObj, pickPoint;
string pickPrompt = "请选择Excel数据对象或者CAD表格对象:";
doc.Utility.GetEntity(out returnObj, out pickPoint, pickPrompt);
AcadObject returnCADObj = (AcadObject)returnObj;
//foreach (var item in pickPrompt)
//{
//}
object returnObj1, pickPoint1;
returnCADObj.GetXData("BDMAP_ZDBASEATT", out returnObj1, out pickPoint1);
Type t = pickPoint1.GetType();
IEnumerable<System.Reflection.PropertyInfo> property = from pi in t.GetProperties() where pi.Name.ToLower() == "1".ToLower() select pi;
string a = property.First().GetValue(pickPoint1, null);
//AcadToolbar tool = app.MenuGroups.Item(0).Toolbars.Add("test");
//AcadToolbarItem tbaritem = tool.AddToolbarButton(0, "mycommand1", "new line", "L ", false);
//tbaritem.SetBitmaps("Small iconname ", "Big iconname ");
//Console.ReadLine();
}
private void dhhm_TextChanged(object sender, EventArgs e)
{
}
}
}文章来源地址https://www.toymoban.com/news/detail-678126.html
到了这里,关于c# 根据CAD权籍数据的扩展属性,输出房地一体资料,申请表、审批表等的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!