ArcGIS Engine c#如何实现另存为Mxd地图文档的功能,,求代码

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ArcGIS Engine c#如何实现另存为Mxd地图文档的功能,,求代码相关的知识,希望对你有一定的参考价值。

我保存的代码是这样的,参考着说一下

//保存地图文档
private void Save_Click(object sender, EventArgs e)

try

//判断pMapDocument是否为空,
//获取pMapDocument对象
IMxdContents pMxdC;
pMxdC = axMapControl1.Map as IMxdContents;
IMapDocument pMapDocument = new MapDocumentClass();
pMapDocument.Open(axMapControl1.DocumentFilename, "");
IActiveView pActiveView = axMapControl1.Map as IActiveView;
pMapDocument.ReplaceContents(pMxdC);
if (pMapDocument == null) return;

//检查地图文档是否是只读
if (pMapDocument.get_IsReadOnly(pMapDocument.DocumentFilename) == true)

MessageBox.Show("本地图文档是只读的,不能保存!");
return;

//根据相对的路径保存地图文档

pMapDocument.Save(pMapDocument.UsesRelativePaths, true);
MessageBox.Show("地图文档保存成功!");

catch (Exception ex)

MessageBox.Show(ex.Message);





//另存为怎么写
private void menuSaveDoc_Click(object sender, EventArgs e)

//另存为地图文档的实现急求代码

直接调用内部的另存事件
m_mapControl = (IMapControl3)this.axMapControl1.Object;
ICommand command = new ControlsSaveAsDocCommandClass();
command.OnCreate(m_mapControl.Object);
command.OnClick();
参考技术A 从网上搜 AE开发邱洪刚的书。 参考技术B 你看看pMapDocument这个对象有没有SaveAs这个方法

C# 读取Excel模板 修改某行某列的值 另存为新的Excel

 1  protected Application objExcelApp;//定义Excel Application对象
 2  private Workbooks objExcelWorkBooks;//定义Workbook工作簿集合对象
 3  protected Workbook objExcelWorkbook;//定义Excel workbook工作簿对象
 4  private Worksheet objExcelWorkSheet;//定义Workbook工作表对象
 5 
 6 
 7 
 8 
 9 try{
10  string workTmp = Server.MapPath("~/BJYH2014/QuarterReportExcel.xlsx");
11  objExcelApp = new ApplicationClass();
12  objExcelWorkBooks = objExcelApp.Workbooks;
13  objExcelWorkbook = objExcelWorkBooks.Open(workTmp, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
14 
15 
16  objExcelWorkSheet = (Worksheet)objExcelWorkbook.Worksheets[1]; //strSheetName是指的Exce工作簿的Sheet名,如果没有命名则为"1" 
17 
18                     objExcelWorkSheet.Cells[20, 2] = "100";//intRow,行;intCol;列;strValue,你处理完以后的值
19                     objExcelWorkSheet.Cells[20, 3] = "200";//intRow,行;intCol;列;strValue,你处理完以后的值
20                     objExcelWorkSheet.Cells[20, 4] = "300";//intRow,行;intCol;列;strValue,你处理完以后的值
21                     objExcelWorkSheet.Cells[20, 5] = "400";//intRow,行;intCol;列;strValue,你处理完以后的值
22                     objExcelWorkSheet.Cells[20, 6] = "500";//intRow,行;intCol;列;strValue,你处理完以后的值
23                     //object missing = System.Reflection.Missing.Value;
24                     string fileName = string.Format(Server.MapPath("~/BJYH2014/Excel/" + Session["deptname"].ToString() + "隐患排查情况统计表{0}.xlsx"), now.ToString("yyyy-MM-dd-HH-mm-ss"));
25 
26 
27                     objExcelWorkbook.SaveAs(fileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
28                 }
29                 finally
30                 {
31                     objExcelApp.Quit();
32                 }

 

以上是关于ArcGIS Engine c#如何实现另存为Mxd地图文档的功能,,求代码的主要内容,如果未能解决你的问题,请参考以下文章

你好 我用ArcGIS裁切TM后 在ENVI中打开只有轮廓,想请教一下用ArcGIS另存为,Nodata设为0解决的步骤 谢谢

请教:C# winform Rtf另存为图片时不能保存原图片大小的问题

c# arcgis engine 查询shp

C# 使用保存对话框将图片框另存为 jpeg

HTML中保存,另存为,功能是如何实现的

显示“另存为”窗口