This Forum is ARCHIVE only
For LightSwitch questions,
please use the official forums at:

http://social.msdn.microsoft.com/forums/en-US/lightswitch/threads


Blog: Importing and exporting data from excel in LightSwitch
Last Post 12 Jun 2012 10:05 PM by hgminerva. 5 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
The_ReganUser is Offline
New Member
New Member
Send Private Message
Posts:10
Avatar

--
14 Nov 2011 05:55 PM
    Please follow the link to view my latest post. 

    Comments and other ideas on how to wean users off Excel are welcome!

    http://therearefourlightswitches.bl...excel.html
    You can follow my entire LightSwitch journey by going to:

    http://therearefourlightswitches.blogspot.com

    or following me on twitter:

    @The_Regan
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1313
    Avatar

    --
    14 Nov 2011 09:13 PM
    Comments and other ideas on how to wean users off Excel are welcome!

    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    İsmail HatipoğluUser is Offline
    New Member
    New Member
    Send Private Message
    Posts:22
    Avatar

    --
    20 Nov 2011 05:50 PM
    Is it possible to export excel in a web app? I see export to excel in design mode but it doesnt come to my screen...
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1313
    Avatar

    --
    20 Nov 2011 09:59 PM
    Posted By İsmail Hatipoğlu on 21 Nov 2011 01:50 AM
    Is it possible to export excel in a web app? I see export to excel in design mode but it doesnt come to my screen...


    No
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    Michael WashingtonUser is Offline
    Send Private Message
    Posts:1313
    Avatar

    --
    16 Feb 2012 08:04 AM
    Ok it is possible to export Excel in a LightSwitch Web app if you use:
    Using the ComponentOne Excel for Silverlight Control with LightSwitch
    -----------
    Michael Washington
    http://LightSwitchHelpWebsite.com
    hgminervaUser is Offline
    Veteran Member
    Veteran Member
    Send Private Message
    Posts:98
    Avatar

    --
    12 Jun 2012 10:05 PM
    Yes it is possible to export, use CSV format. hope I can help. See my code below:

    Private Sub ExportAccountToCSV_Execute()
    Dim csv As String = GetAccountCSV()
    AddHandler Me.FindControl("ExportAccountToCSV").ControlAvailable,
    (Function(object1, eventargs1)
    Dim btnExport As Button = DirectCast(eventargs1.Control, Button)
    AddHandler btnExport.Click,
    (Function(object2, eventargs2)
    Dim dialog = New SaveFileDialog()
    dialog.Filter = "CSV (*.csv)|*.csv"
    If dialog.ShowDialog() = True Then
    Using stream As New StreamWriter(dialog.OpenFile())
    stream.Write(csv)
    stream.Close()
    End Using
    End If
    End Function)
    End Function)
    End Sub

    Private Function GetAccountCSV() As String
    Dim csv As New StringBuilder()
    Dim i As Integer = 0

    For Each a In mstAccounts
    If i = 0 Then
    csv.AppendFormat("AccountNumber" & "," & "AccountName" & "," & "AccountType" & System.Environment.NewLine, a)
    End If
    csv.AppendFormat(a.AccountNumber & "," & a.AccountName & "," & a.AccountType & System.Environment.NewLine, a)
    i = i + 1
    Next

    If csv.Length > 0 Then
    Return csv.ToString(0, csv.Length - 1)
    Else
    Return ""
    End If
    End Function
    http://hgminerva.wordpress.com
    You are not authorized to post a reply.


    Microsoft Visual Studio is a registered trademark of Microsoft Corporation / LightSwitch is a registered trademark of Microsoft Corporation