Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 1
Default Export Excel tuncating leading zeros while export to excel from da

I have created windows application in VB.Net for export excel functionality
from datatable.
For this I used "Interop.Excel.dll" and "Interop.Office.dll" and created
worksheet as below

Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add



Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1),
Excel.Worksheet).





For cntDs As Integer = 0 To dsExport.Tables.Count - 1




With excelWorksheet
.....
....




End With



Next

Its working fine. But once the data opened in the excel sheet (excel 2007),
if there is any number with leading zero (eg:00123), it will be truncated
which i dont want.

Even though if I change the format of excel sheet as text after loading the
data, the truncated zeros are not coming. Is there any property in excel 2007
to stop truncating leading zeros? Please advise.

Thanks in advance,
HR.


  #2   Report Post  
Posted to microsoft.public.excel.setup
external usenet poster
 
Posts: 35,218
Default Export Excel tuncating leading zeros while export to excel from da

Try changing the number format to text before you put in the value. And make
sure that value that your using really contains the leading 0's.

Or leave the cell numeric, but give it a custom format of: 000000 (as many
leading 0's as you need).

RHBKV wrote:

I have created windows application in VB.Net for export excel functionality
from datatable.
For this I used "Interop.Excel.dll" and "Interop.Office.dll" and created
worksheet as below

Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add



Dim excelWorksheet As Excel.Worksheet = CType(excelBook.Worksheets(1),
Excel.Worksheet).



For cntDs As Integer = 0 To dsExport.Tables.Count - 1



With excelWorksheet
....
...



End With



Next

Its working fine. But once the data opened in the excel sheet (excel 2007),
if there is any number with leading zero (eg:00123), it will be truncated
which i dont want.

Even though if I change the format of excel sheet as text after loading the
data, the truncated zeros are not coming. Is there any property in excel 2007
to stop truncating leading zeros? Please advise.

Thanks in advance,
HR.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
export re-order input fields to export file [csv] madisonpete Excel Worksheet Functions 0 November 30th 07 03:51 PM
Excel Leading Zeros Brandy Excel Discussion (Misc queries) 3 October 1st 07 07:20 PM
leading zeros in excel kiwi Excel Discussion (Misc queries) 3 May 17th 05 06:59 PM
How to export excel column into Access without losing the leading. yesterdaytoday11 Excel Discussion (Misc queries) 5 March 23rd 05 03:09 PM
How do I display leading zeros so I can export a fixed in Excel? World Referee and accountant Excel Discussion (Misc queries) 2 January 3rd 05 04:18 PM


All times are GMT +1. The time now is 06:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"