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

Antwort per Email an