本文整理汇总了C#中Microsoft.Office.Interop.Excel.Worksheet.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# Worksheet.Delete方法的具体用法?C# Worksheet.Delete怎么用?C# Worksheet.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Office.Interop.Excel.Worksheet
的用法示例。
在下文中一共展示了Worksheet.Delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportSelectedRecordsToExcel
//.........这里部分代码省略.........
// Set the properties of the Step Progressor
System.Int32 int32_hWnd = _app.hWnd;
progressDialogFactory = new ESRI.ArcGIS.Framework.ProgressDialogFactoryClass();
stepProgressor = progressDialogFactory.Create(trackCancel, int32_hWnd);
stepProgressor.MinRange = 0;
stepProgressor.MaxRange = mxdoc.FocusMap.SelectionCount;
stepProgressor.StepValue = 1;
stepProgressor.Message = A4LGSharedFunctions.Localizer.GetString("ExportXL");
// Create the ProgressDialog. This automatically displays the dialog
progressDialog = (ESRI.ArcGIS.Framework.IProgressDialog2)stepProgressor; // Explict Cast
// Set the properties of the ProgressDialog
progressDialog.CancelEnabled = true;
progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("ExportAsset") + "1" + A4LGSharedFunctions.Localizer.GetString("Of") + mxdoc.FocusMap.SelectionCount.ToString() + ".";
progressDialog.Title = A4LGSharedFunctions.Localizer.GetString("ExportXL");
progressDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressGlobe;
progressDialog.ShowDialog();
if ((feat != null) && (selectionInTable == true))
{
ExcelApp = new Excel.ApplicationClass();
//Delete default worksheets
ExcelApp.DisplayAlerts = false;
objBook = ExcelApp.Workbooks.Add(missing);
//objBook = ExcelApp.Workbooks.get_Item(1);
for (int m = objBook.Sheets.Count; m > 1; m--)
{
objSheet = (Excel.Worksheet)objBook.Sheets.get_Item(m);
objSheet.Delete();
}
featlayer = (IFeatureLayer)enumLayer.Next();
while (featlayer != null)
{
if ((featlayer.Valid) && (featlayer.Selectable))
{
featSel = (IFeatureSelection)featlayer;
if (featSel.SelectionSet.Count > 0)
{
ExportLayer(objBook, mxdoc, featlayer, ref progressDialog, ref stepProgressor);
}
}
featlayer = (IFeatureLayer)enumLayer.Next();
}
for (i = 0; i < standTableCnt; i++)
{
standTable = standTabColl.get_StandaloneTable(i);
if (standTable.Valid)
{
openTable = (ITable)standTable;
tableSel = (ITableSelection)openTable;
if (tableSel.SelectionSet.Count > 0)
{
ExportTable(objBook, mxdoc, standTable, ref progressDialog, ref stepProgressor);
}
}
}
}
else if ((feat != null) && (selectionInTable == false))