hallo patrick!
ich find auch, es ist die einfachste und schnellste methode..... also so wie
du es machst.
du kannst mal folgendes versuchen (keine ahnung ob das funktioniert):
im excel autoformat einschalten und/oder bei den zellen mit zahlen ein +
(pluszeichen) vor die zahl stellen
lg,
oskar
From: "Brunmair Patrick (DLG)" <[EMAIL PROTECTED]>
Reply-To: asp.net@glengamoi.com
To: <asp.net@glengamoi.com>
Subject: AW: [Asp.net] Excel export
Date: Thu, 17 Nov 2005 14:31:02 +0100
Wie sollte ich dass sonst machen ?? muß ich doch oder nicht ???
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von Daniel Wasser
Gesendet: Donnerstag, 17. November 2005 10:45
An: asp.net@glengamoi.com
Betreff: Re: [Asp.net] Excel export
Sorry,
meinte natürlich
.xls
Daniel Wasser wrote:
> Hallo Patrick,
> verstehe ich richtig, das du eigentlich HTML
> "verkleidet" als .xml sendest?
>
>
> Grüße, Daniel
>
>
> Brunmair Patrick (DLG) wrote:
>> Hallo,
>> ich mache einen excel export aus einem datagrid heraus , dass
>> funktioniert eigentlich ganz gut doch ich bekomme in excel die werte
>> als text rein.
>> Daher kann ich keine berechnungen durchführen (wenn ich sie nicht
>> umwandle).
>> Kann man dass beim export irgendwie definieren ?? Hier mal mein excel
>> export:
>>
>>
>> If grid.Items.Count.ToString + 1 < 65536 Then
>> HttpContext.Current.Response.Clear()
>> HttpContext.Current.Response.ContentType =
>> "application/vnd.ms-excel"
>>
>> HttpContext.Current.Response.AddHeader("content-disposition",
>> "attachment;filename=" & saveAsFile & ".xls")
>> ' Remove the charset from the Content-Type header.
>> HttpContext.Current.Response.Charset = ""
>> 'HttpContext.Current.Response.WriteFile("style.txt")
>> ' Turn off the view state.
>> grid.EnableViewState = False
>> Dim tw As New System.IO.StringWriter
>> Dim hw As New System.Web.UI.HtmlTextWriter(tw)
>> ' Get the HTML for the control.
>> grid.HeaderStyle.ForeColor = Color.Black
>> grid.HeaderStyle.BackColor = Color.Red
>> grid.ItemStyle.ForeColor = Color.Black
>> grid.BorderColor = Color.White
>> ClearControls(grid)
>> grid.RenderControl(hw)
>> ' Write the HTML back to the browser.
>> HttpContext.Current.Response.Write(tw.ToString())
>> ' End the response.
>> HttpContext.Current.Response.End()
>>
>>
>> Sub ClearControls(ByVal control As Control)
>> Dim i As Integer
>> For i = control.Controls.Count - 1 To 0 Step -1
>> ClearControls(control.Controls(i))
>> Next i
>>
>> If TypeOf control Is System.Web.UI.WebControls.Image Then
>> control.Parent.Controls.Remove(control)
>> End If
>>
>> If (Not TypeOf control Is TableCell) Then
>> If Not (control.GetType().GetProperty("SelectedItem") Is
>> Nothing) Then
>> Dim literal As New LiteralControl
>> control.Parent.Controls.Add(literal)
>> Try
>> literal.Text =
>> CStr(control.GetType().GetProperty("SelectedItem").GetValue(control,
>> Nothing))
>> Catch
>> End Try
>> control.Parent.Controls.Remove(control)
>> Else
>> If Not (control.GetType().GetProperty("Text") Is
>> Nothing) Then
>> Dim literal As New LiteralControl
>> control.Parent.Controls.Add(literal)
>> literal.Text =
>> CStr(control.GetType().GetProperty("Text").GetValue(control, Nothing))
>> control.Parent.Controls.Remove(control)
>> End If
>> End If
>> End If
>> Return
>> End Sub 'ClearControls
>>
>>
>> Mit freundlichen Grüßen
>>
>> Patrick Brunmair
>>
>> _______________________________________________
>> Asp.net Mailingliste, Postings senden an:
>> Asp.net@glengamoi.com
>> An-/Abmeldung und Suchfunktion unter:
>> http://www.glengamoi.com/mailman/listinfo/asp.net
>>
>>
> _______________________________________________
> Asp.net Mailingliste, Postings senden an:
> Asp.net@glengamoi.com
> An-/Abmeldung und Suchfunktion unter:
> http://www.glengamoi.com/mailman/listinfo/asp.net
>
>
_______________________________________________
Asp.net Mailingliste, Postings senden an:
Asp.net@glengamoi.com
An-/Abmeldung und Suchfunktion unter:
http://www.glengamoi.com/mailman/listinfo/asp.net
_______________________________________________
Asp.net Mailingliste, Postings senden an:
Asp.net@glengamoi.com
An-/Abmeldung und Suchfunktion unter:
http://www.glengamoi.com/mailman/listinfo/asp.net
_______________________________________________
Asp.net Mailingliste, Postings senden an:
Asp.net@glengamoi.com
An-/Abmeldung und Suchfunktion unter:
http://www.glengamoi.com/mailman/listinfo/asp.net