Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2005, 09:02 AM
Registered User
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating an Excel File from .NET with numeric fiel

Hi All,

Could some body pls help me with the following problem.

I am using Visual Studio to create an Excel file (i.e. the file has an .xls extension with a TAB charactor between the cells).

However I lose the formatting on numeric cells, see example :-

1) I put the value 123.40 in a cell, but when opened the file I see 123.4

2) Also same with 00100, when opened I see 100

Does any one have the answer to this ?

Also, on the same lines, can I left justity numeric fields, as it always right justifys it.

Many thanks for any help,

Neil.

 
Old December 11th, 2005, 12:46 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Unless you actually create a real excel file, you won't be able to specify the formatting of the sheet. All you are creating is a character delimited text file that happens to open in Excel. You would probably get the same results if you made the file with a CSV extension.

You might be able to interact directly with Excel objects and create a new document and sheet, add values to the cells and specify the formatting. I don't know how to do this however.

-Peter
 
Old December 12th, 2005, 04:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

check out http://www.greggriffiths.org/webdev/both/excel/ for some examples of this.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get data from Excel file using ADO.NET lam_lvl ADO.NET 7 February 27th, 2014 05:19 AM
Creating Excel File vikas67k C# 6 March 4th, 2010 05:02 AM
Import numeric value into the excel sushant Excel VBA 3 October 20th, 2005 01:43 PM
Creating an excel file and showing on the form dotnetprogrammer C# 0 May 3rd, 2005 07:36 AM
Creating .ocx file in .net roy VS.NET 2002/2003 2 April 12th, 2005 07:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.