DataJuggler.ExcelerateWinApp 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet new install DataJuggler.ExcelerateWinApp::1.0.0                
This package contains a .NET Template Package you can call from the shell/command line.

DataJuggler.ExcelerateWinApp

ExcelerateWinApp is a WinForms app designed to make it easy to load and save Excel objects that were created using Blazor Excelerate https://excelerate.datajuggler.com Code Generate C# Classes From Excel Header Rows

Instructions to run this project:

To Install Via Nuget and DOT NET CLI, navigate to the folder you wish to create your project in

cd c:\Projects\ExcelerateWinApp
dotnet new install DataJuggler.ExcelerateWinApp
dotnet new DataJuggler.ExcelerateWinApp

or

Clone this project from GitHub https://github.com/DataJuggler/ExcelerateWinApp

Setup Instructions

  1. Create one or more classes from Excel Header Rows at Blazor Excelerate https://excelerate.datajuggler.com Download the MemberData.xlsx from the above site to see an example. Use ExcelerateWinApp.Objects for the namespace or rename this project to your liking

  2. Copy the objects into the Objects folder of ExcelerateWinApp

  3. Load Excel Worksheet(s) - Example is include in UpdateButton_Click event

    // load your object(s) string workbookPath = FileSelector.Text;

    // Example WorksheetInfo objects
    WorksheetInfo info = new WorksheetInfo(); info.LoadColumnOptions = LoadColumnOptionsEnum.LoadAllColumnsExceptExcluded; info.Path = workbookPath;

    // Set your SheetName info.SheetName = "Address";

    // Example WorksheetInfo objects
    WorksheetInfo info2 = new WorksheetInfo(); info2.LoadColumnOptions = LoadColumnOptionsEnum.LoadAllColumnsExceptExcluded; info2.Path = workbookPath;

    // Example load Worksheet Worksheet addressWorksheet = ExcelDataLoader.LoadWorksheet(workbookPath, info); Worksheet statesWorksheet = ExcelDataLoader.LoadWorksheet(workbookPath, info2);

  4. Load your list of objects

    // Examples loading the Address sheet from MemberData.xlsx List<Address> addresses = Address.Load(addressWorksheet); List<States> states = States.Load(statesWorksheet);

  5. Perform updates on your List of objects

    For this example, I inserted a column StateName into the Address sheet in Excel and added a few state names manually. You must add a few entries so the data type can be attempted to be determined. Then code generated Address and States objects using Blazor Excelerate https://excelerate.datajuggler.com

    This method set the Address.StateName for each row by looking up the State Name by StateId

    /// <summary>
    /// Lookup the StateName for each Address object by StateId
    /// </summary>
    public void FixStateNames(ref List<Address> addresses, List<States> states)
    {
       // verify both lists exists and have at least one item
       if (ListHelper.HasOneOrMoreItems(addresses, states))
       {
           // Iterate the collection of Address objects
           foreach (Address address in addresses)
           {
               // get a local copy
               int stateId = address.StateId;
    
               // set the stateName
               address.StateName = states.Where(x => x.Id == stateId).FirstOrDefault().Name;
    
               // Increment the value for Graph
               Graph.Value++;
    
               // update the UI every 100
               if (Graph.Value % 100 == 0)
               {
                   Refresh();
                   Application.DoEvents();
                }
           }
        }
     }
    
  6. Save your worksheet back to Excel

    // resetup the graph                    
    Graph.Maximum = addresses.Count;
    Graph.Value = 0;
    
    // change the text
    StatusLabel.Text = "Saving Addresses please wait...";
    
    // you must convert the list objects to List<IExcelerateObject> before it can be saved
    List<IExcelerateObject> excelerateObjectList = addresses.Cast<IExcelerateObject>().ToList();
    
    // Now save the worksheet
    SaveWorksheetResponse response = ExcelHelper.SaveWorksheet(excelerateObjectList, addressWorksheet, info, SaveWorksheetCallback, 500);
    
  7. (Optional) Leave a Star on DataJuggler.Excelerate, Blazor Excelerate or this project on GitHub

    DataJuggler.Excelerate https://github.com/DataJuggler/Excelerate

    Blazor Excelerate https://github.com/DataJuggler/Blazor.Excelerate

    Excelerate Win App https://github.com/DataJuggler/ExcelerateWinApp

  8. (Optional) Subscribe to my YouTube channel https://youtube.com/DataJuggler

News

1.0.0 7.23.2023: First Working Version Released

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.8 664 8/14/2023
1.0.7 247 8/14/2023
1.0.6 232 8/14/2023
1.0.5 181 7/24/2023
1.0.4 177 7/24/2023
1.0.3 161 7/24/2023
1.0.2 162 7/24/2023
1.0.1 167 7/23/2023
1.0.0 172 7/23/2023

7.23.2023: This is the first release of this project.