资源简介
使用步骤:
1. 使用Microsoft Visual Studio 2008打开解决方案,并重新编译;
2. 重新编译后在解决方案文件同级的目录下会产生两个文件夹,分别是BinD和WorkEnvironment;
3. 拷贝BinD目录下的CustomContextMenuStrip.dll到
SuperMap Deskpro .NET的安装目录下..Bin/Plugins/CustomContextMenuStrip文件夹中,如果CustomContextMenuStrip不存在,请先新建一个。
4. 拷贝WorkEnvironment目录下的
CustomContextMenuStrip.config到SuperMap Deskpro .NET的安装目录下..WorkEnvironment/Default文件夹中。
5.打开矢量数据集后点击右键,弹出右键菜单,如示意图1所示,将选中的数据集属性导出到Excel文件中。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using SuperMap.Desktop;
using Application = SuperMap.Desktop.Application;
using SuperMap.Data;
namespace CustomContextMenuStrip
{
class MyCtrlAction : CtrlAction
{
override public void Run()
{
try
{
//定位到某个表中
Microsoft.Office.Interop.Excel.Application myexcel = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbooks workbooks = myexcel.Workbooks;
Microsoft.Office.Interop.Excel.Workbook workbook =
workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
;
Microsoft.Office.Interop.Excel.Worksheet sheet =
(Microsoft.Office.Interop.Excel.Worksheet) workbook.Worksheets[1];
Microsoft.Office.Interop.Excel.Range range = sheet.Columns.get_Range(“H:H“ Type.Missing);
range.Validation.Delete();
range.Validation.Add(Microsoft.Office.Interop.Excel.XlDVType.xlValidateList
Microsoft.Office.Interop.Excel.XlDVAlertstyle.xlValidAlertStop Type.Missing
“123“ Type.Missing);
//获取数据集属性
Dataset[] activeDatasets = Application.ActiveDatasets;
if (activeDatasets.Length != 0)
{
Dataset dataset = activeDatasets[0];
if (dataset.Type == DatasetType.Point || dataset.Type == DatasetType.Region ||
dataset.Type == DatasetType.Line)
{
//确定选中的数据集
DatasetVector Dtv_Aim = dataset as DatasetVector;
FieldInfos fieldInfos = Dtv_Aim.FieldInfos;
//赋字段名
for (int i = 1; i < fieldInfos.Count + 1; i++)
{
sheet.Cells[1 i] = fieldInfos[i - 1].Name.ToString();
}
Recordset recordset = Dtv_Aim.GetRecordset(false CursorType.Dynamic);
if (recordset.RecordCount != 0)
{
//弹出保存Excel对话框
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = “*.xlsx|*.xlsx“;
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
recordset.MoveFirst();
int j = 2;
while (!recordset.IsEOF)
{
object[] value = recordset.GetValues();
for (i
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\
文件 1074 2012-05-10 22:12 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\CustomContextMenuStrip.config
文件 6656 2012-05-10 22:12 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\CustomContextMenuStrip.dll
文件 15872 2012-05-10 22:12 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\CustomContextMenuStrip.pdb
文件 1100392 2007-10-10 09:48 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\Microsoft.Office.Interop.Excel.dll
文件 1309492 2005-04-19 14:48 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\Microsoft.Office.Interop.Excel.xm
文件 20080 2007-10-10 09:48 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\Microsoft.Office.Interop.SmartTag.dll
文件 64088 2007-10-10 09:48 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\Microsoft.Vbe.Interop.dll
文件 223800 2007-10-10 09:48 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\office.dll
文件 387947 2005-04-19 14:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\office.xm
文件 6155776 2012-03-31 09:36 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\SuperMap.Data.dll
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\zh-CN\
文件 114688 2012-03-31 09:36 CustomContextMenuStrip(修改)\CustomContextMenuStrip\BinD\zh-CN\SuperMap.Data.resources.dll
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\$SuperMapDesktopHome$\
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\$SuperMapDesktopHome$\Bin\
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\$SuperMapDesktopHome$\Bin\Plugins\
目录 0 2012-05-11 08:25 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\$SuperMapDesktopHome$\Bin\Plugins\CustomContextMenuStrip\
文件 4494 2012-04-08 15:59 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\CtrlAction.cs
文件 1021 2012-05-11 09:05 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\CustomContextMenuStrip.config
文件 4945 2012-05-10 22:12 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\CustomContextMenuStrip.csproj
文件 1048 2012-04-08 16:26 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\CustomContextMenuStrip.csproj.user
文件 524 2012-04-08 15:23 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\DesktopPlugin.cs
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\obj\
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\obj\X86\
目录 0 2012-05-11 08:42 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\obj\X86\Debug\
文件 1748 2012-05-10 22:12 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\obj\X86\Debug\CustomContextMenuStrip.csproj.FileListAbsolute.txt
文件 6656 2012-05-10 22:12 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\obj\X86\Debug\CustomContextMenuStrip.dll
文件 15872 2012-05-10 22:12 CustomContextMenuStrip(修改)\CustomContextMenuStrip\CustomContextMenuStrip\obj\X86\Debug\CustomContextMenuStrip.pdb
............此处省略10个文件信息
- 上一篇:收集的几个Flash小游戏源代码
- 下一篇:noip2009测试数据
相关资源
- 教学管理系统源码.net
- .net学生运动会管理系统
- AutoCAD .NET开发指南-2012版 pdf
- 最新版 .net reactor 5.0.0 破解版
- 智能拼图游戏.NET 开发源码
- Octane_SDK_.NET_2_26_1.zip
- .net 网口热敏机打印demo
- photoSprite
- .NET程序设计大作业
- VS .NET报表开发之RDLC报表随笔
- 企业进销存管理系统 信息化管理软件
- 个人博客管理系统
- .net课程设计 商店客户管理系统
- .net新闻管理系统(增删改查)
- .NET3层架构家庭理财系统,内含水晶报
- CKEditor5 classic for .net core Demo
- NCO4.0 RFC接口开发
- Web_拼车网
- 老年公寓信息管理系统
- AnyCAD三维控件用户手册 v2015
- 电子商务网站(前台+后台)
- teechart2016for.net最新破解版
- .net新闻系统(开源学习版)
- 学生MIS信息管理系统源码
- 酒店管理系统 简单 很适合做课程设计
- CIM技术白皮书beta1.0.pdf
- [2019超图研究院]SuperMap倾斜摄影白皮书
- 社会养老保险信息管理系统
- EPPlus 4.5.3.1
- .net小型论坛系统源码
评论
共有 条评论