Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Urgent Pls!!!!! Problem while exporting data to excel sheet in asp

Thread Tools

Urgent Pls!!!!! Problem while exporting data to excel sheet in asp

Posts: n/a

I am exporting data from database to an excel sheet. Some of the data have
"+/-" .For example: "120+/-10"

When i connect to the local database and export the data, it does export
correctly say "120+/-10" . But when i connect to production database, it does
not export data correctly say "120 10" .

Does any have idea of what is going wrong here. Ihave attached test file
Pls Help

here is test.aspx file

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="test.aspx.vb"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content=""
<LINK href="resources/newClass.css" type="text/css" rel="STYLESHEET">
<body class="pagebackground" leftMargin="1" topMargin="1" rightMargin="2">
<form id="Form2" method="post" runat="server">
<table id="TestTable" runat=server cellSpacing="0" cellPadding="0"
width="100%" border="0">

here is test.aspx.vb file

Public Class test
Inherits System.Web.UI.Page
Protected WithEvents TestTable As System.Web.UI.HtmlControls.HtmlTable
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Response.Buffer = True
Response.ContentType = "application/"
Dim i As Integer
For i = 0 To 9
Dim Ptr As New HtmlTableRow()
addData(Ptr, "70+/-2")
TestTable.Controls.AddAt(i, Ptr)
End Sub
Public Sub addData(ByRef Ptr As HtmlTableRow, ByVal txtStr As String)
Dim Ptc1 As New HtmlTableCell()
Ptc1.InnerText = txtStr
End Sub
End Class

Now if we run this file it should open excel file and write "70+/-2" in 10
lines. but it is writing "702" in 10 lines.

if i comment following 3 lines in page_load events then it is displaying
"70+/-2" in 10 lines on browser.

Response.Buffer = True
Response.ContentType = "application/"

please help me.
Reply With Quote
Jim Corey
Posts: n/a


Try adding hard-coded quotation marks around the strings.
This can prevent excel from formatting the data.

I don't have any code in front on me, but if I recall correctly, sending
meant excel would treat this as a string (the quotes would not be
displayed), whereas
meant excel would treat it as a number.

Maybe this would help in your situation.


*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting Stored procedure results to the Excel Sheet using Java AD1234 Java 5 03-28-2008 09:28 AM
change the sheet name while exporting datagrid data to excel =?Utf-8?B?U3JpZGhhcg==?= ASP .Net 0 11-09-2006 02:37 PM
CPU usage 99% (aspnet_wp.exe) while importing excel sheet Vivek ASP .Net 1 12-16-2004 03:23 PM
Urgent!!!!! Problem while exporting data to excel sheet in =?Utf-8?B?U2lsZWVzaA==?= ASP .Net 4 11-05-2004 10:57 PM
Exporting Datagrid's data to an Excel Sheet. ASP .Net 1 10-25-2004 10:24 PM