Hi All, I am trying to create an add-in button that allows the selected features to be exported out into an excel work book. I have been able to loop through the features and get the selected features but am not sure how to write out its attribute table to an excel workbook. I have unsucessfully tried the ExcelWorkspaceFactory. Anybody knows how to solve this one.Any help will be appreciated.Regards
QueryFilter queryFilter = new QueryFilterClass(); queryFilter.WhereClause = "OBJECTID <> 0"; int rowIndex = featClass.FeatureCount(queryFilter); int columnIndex = featClass.Fields.FieldCount; if (rowIndex > 0) { string[,] valuesArray = new string[rowIndex, columnIndex]; for (int i = 0; i < rowIndex; i++) { IFeature feat = featClass.GetFeature(i + 1); for (int j = 0; j < feat.Fields.FieldCount; j++) { string fieldValue = feat.get_Value(j).ToString(); valuesArray.SetValue(fieldValue, i, j); } } //more logic }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.