Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i want this to have two columns in excel can i do that

 

 

Dim writer As New System.IO.StreamWriter("test.xls")
       writer.Write(ComboBox1.Items(0))
       writer.Write(ComboBox1.Items(1))
       writer.WriteLine(a)
       writer.WriteLine(b)
       writer.Flush()
       writer.Close()

  • Leaders
Posted
The 'easiest' way would probably be to add the Reference to the MS Excel ##.# library, create your workbooks and worksheets through code, or somehow, and then use Excel library methods to save an excel .Xls spreadsheet file. :)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Posted

If you don't care about formatting, you can write a file in CSV (Comma Separated Values) format. This involves placing a comma between each column and surrounding each column with "". End each row with a new line.

 

CSV files will open in Excel - Excel is the default program associated with them.

 

Dim writer As New System.IO.StreamWriter("test.xls")
writer.Write("""" & ComboBox1.Items(0) & """,")
writer.Write("""" & ComboBox1.Items(1) & """")
writer.WriteLine()
writer.Close()

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

  • 5 years later...
  • 3 years later...
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...