Hvis du er helt nystartet i C#, er det nok lidt overkill at begynde at generere en Excel fil med et Excel API. Gem dine værdier i en csv fil i stedet for. 
F.eks. værdi1;værdi2;værdi3
Du kan f.eks. gøre sådan her:
-  using System;
 -  using System.IO;
 -  using System.Text;
 -  
 -  namespace SaveToFile
 -  {
 -      class Program
 -      {
 -          static void Main(string[] args)
 -          {
 -              //Opens the file in a stream
 -              using (Stream stream = new FileStream(@"c:\test\test.csv", FileMode.OpenOrCreate))
 -              {
 -                  //Moves to the end of the file
 -                  stream.Seek(0, SeekOrigin.End);
 -                  //Creates the line to insert in your "Excel" document
 -                  string row = string.Format("{0};{1};{2}{3}", 12.5, "whatever", 1, Environment.NewLine);
 -                  ASCIIEncoding encoding = new ASCIIEncoding();
 -                  //Writes to the file
 -                  stream.Write(encoding.GetBytes(row), 0, row.Length);
 -                  stream.Flush();
 -              }
 -          }
 -      }
 -  }
 
En csv fil kan åbnes af Excel og der laves en ny celle for hver ;
						
						
						
						
		
							Indlæg senest redigeret d. 05.12.2008 16:40 af Bruger #13106