title: How to programatically convert the text file to a custom made specific excel format with nice tabulated grid
body: <p>I would like to convert my text file <a href="https://imageshack.com/i/eyRUOp6fj" rel="nofollow">https://imageshack.com/i/eyRUOp6fj</a> to a specific <strong>excel format</strong> as shown here <a href="https://imageshack.com/i/iqVnLA9vj" rel="nofollow">https://imageshack.com/i/iqVnLA9vj</a>. How can i do this.</p>
  
  <p>In the text file, there are number of components which <strong>has same location name</strong>. So basically I want to <strong>cluster all components with same location name to one row</strong>, with total number of components in the 2nd column and so on. Please guide me how can i do this.</p>
  
  <p>Code Snippet: </p>
  
  <pre><code> string[] lines = File.ReadAllLines(@"c:\bleh\testdata.txt");
   List&lt;Item&gt; allItems = new List&lt;Item&gt;(lines.Length);
   Dictionary&lt;string, List&lt;Item&gt;&gt; itemsByLocation = new Dictionary&lt;string, List&lt;Item&gt;&gt;   (StringComparer.OrdinalIgnoreCase);
  // loop the file, start at 1 assuming headings first row
  for (int i = 1; i &lt; lines.Length; i++)
  {
  // nothing interesting here, just parsing the file
  string[] columns = lines[i].Split(new char[] { ';', ',' });                
  Item item = new Item() { 
      Designator = columns[ORDINAL_DESIGNATOR], 
      MaxPn = columns[ORDINAL_MAXPN], 
      Footprint = columns[ORDINAL_FOOTPRINT], 
      Location = columns[ORDINAL_LOCATION] };
  
  allItems.Add(item);
  List&lt;Item&gt; itemsForThisKey = null;
  if (itemsByLocation.TryGetValue(item.Location, out itemsForThisKey) == false)
  {
      // we don't already have this location in the dictionary, add it
      itemsForThisKey = new List&lt;Item&gt;();
      itemsByLocation.Add(item.Location, itemsForThisKey);
  }
  itemsForThisKey.Add(item); // add this item to the relevant grouping
  </code></pre>
  
  <p>}</p>
  
  <p>I am getting error in Item <code>Error   1   The type or namespace name 'Item' could not be found (are you missing a using directive or an assembly reference?)</code>
  Also, error for <code>Error  7   The name 'ORDINAL_DESIGNATOR' does not exist in the current context</code> Any helps please!!!
  Thanks a lot.</p>