<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Export selection to Excel C# in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696043#M18652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can also use a 3rd party component, for example look at this &lt;/SPAN&gt;&lt;A href="http://www.eleriumsoft.com/Excel_NET/ExcelNET/Default.aspx"&gt;Excel Writer&lt;/A&gt;&lt;SPAN&gt; to work with excel files in C#.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Feb 2013 03:53:34 GMT</pubDate>
    <dc:creator>DonaldGreen</dc:creator>
    <dc:date>2013-02-14T03:53:34Z</dc:date>
    <item>
      <title>Export selection to Excel C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696041#M18650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; 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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have unsucessfully tried the ExcelWorkspaceFactory. Anybody knows how to solve this one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help will be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2011 07:58:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696041#M18650</guid>
      <dc:creator>FaizanTayyab</dc:creator>
      <dc:date>2011-05-03T07:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Export selection to Excel C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696042#M18651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have a look at this older thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=992&amp;amp;t=227281"&gt;http://forums.esri.com/Thread.asp?c=93&amp;amp;f=992&amp;amp;t=227281&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Otherwise, you will have to write your attributes to an ADO.NET DataTable/Dataset then either setup an OleDbDataAdapter to run the updates/inserts to Excel or do this via Excel Automation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry -- I don't have much sample code on this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2011 16:51:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696042#M18651</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2011-05-03T16:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Export selection to Excel C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696043#M18652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can also use a 3rd party component, for example look at this &lt;/SPAN&gt;&lt;A href="http://www.eleriumsoft.com/Excel_NET/ExcelNET/Default.aspx"&gt;Excel Writer&lt;/A&gt;&lt;SPAN&gt; to work with excel files in C#.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 03:53:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696043#M18652</guid>
      <dc:creator>DonaldGreen</dc:creator>
      <dc:date>2013-02-14T03:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Export selection to Excel C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696044#M18653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt; 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. &lt;BR /&gt;&lt;BR /&gt;I have unsucessfully tried the ExcelWorkspaceFactory. Anybody knows how to solve this one.&lt;BR /&gt;&lt;BR /&gt;Any help will be appreciated.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Take a look at this: &lt;/SPAN&gt;&lt;A href="http://npoi.codeplex.com/" rel="nofollow noopener noreferrer" target="_blank"&gt;NPOI&lt;/A&gt;&lt;SPAN&gt;, it's really easy to write data to excel with this libraries. Lately i did a utility for arccatalog that is doing exactly the same thing you are willing to do . Sample:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
QueryFilter queryFilter = new QueryFilterClass();
queryFilter.WhereClause = "OBJECTID &amp;lt;&amp;gt; 0";
int rowIndex = featClass.FeatureCount(queryFilter);
int columnIndex = featClass.Fields.FieldCount;

if (rowIndex &amp;gt; 0)
{
 string[,] valuesArray = new string[rowIndex, columnIndex];
 for (int i = 0; i &amp;lt; rowIndex; i++)
 {
&amp;nbsp; IFeature feat = featClass.GetFeature(i + 1);

&amp;nbsp; for (int j = 0; j &amp;lt; feat.Fields.FieldCount; j++)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; string fieldValue = feat.get_Value(j).ToString();
&amp;nbsp;&amp;nbsp; valuesArray.SetValue(fieldValue, i, j);
&amp;nbsp; }
 }
 //more logic
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will have to adjust it to your needs since i wanted all feature and you want only the selected features to be write into excel.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It's a bit tricky later since you will have to iterate through the 2-dimensional array to write it down to excel, but you will figure it out:) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MDruzgala&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:18:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-selection-to-excel-c/m-p/696044#M18653</guid>
      <dc:creator>MarcinDruzgala</dc:creator>
      <dc:date>2021-12-12T05:18:12Z</dc:date>
    </item>
  </channel>
</rss>

