Save

Introduction

Warning

We recommend that you use either ListViewContentXML or ListViewContentJson instead of our custom system which is old and outdated.

a. Required configuration

To use the following methods, you need to use the version 1.7 or higher of LeoCorpLibrary, and put this at the top of your code file:

C#

using LeoCorpLibrary;

VB

Imports LeoCorpLibrary

b. How it works

Here's how the Save system works:

  1. The system is going to separate the elements with a separator which is by default (*E*).
  2. The system is going to separate the elements' columns with a separator which is by default (*C*)
  3. The system save this content in a specified file.

Here's an example of a file:

Test1(*C*)Test2(*C*)Test3(*E*)Test4(*C*)Test5(*C*)Test6(*E*)Test7(*C*)Test7(*C*)Test8(*E*)

Note

You can save the file in any formats, even custom ones: The system doesn't care.

Functions

a. ListViewContentCustom

This function is available in version 1.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The ListViewContentCustom() method enables you to save the content of a ListView. We recommend that you use these following parameters for your ListView:

  • Details vue mode
  • FullRowSelect = true

There is two variations of the method:

Variation 1

Save.ListViewContentCustom(ListView listview, string filePath) {...}
ValueArgumentDescription
ListViewlistViewListView where it's content needs to be saved
stringfilePathFile location where to save the ListView's content

Variation 2

Save.ListViewContentCustom(ListView listView, string filePath, string itemSplit, string columnSplit) {...}
ValueArgumentDescription
ListViewlistViewListView where it's content needs to be saved
stringfilePathFile location where to save the ListView's content
stringitemSplitElements separator
stringcolumnSplitColumns separator

Here's an example of usage:

C#

// Variation 1
Save.ListViewContentCustom(listView1, @"C:\content.txt");

// Variation 2
Save.ListViewContentCustom(listView1, @"C:\content.txt", "/*E*/", "/*C*/");

VB

' Variation 1
Save.ListViewContentCustom(ListView1, "C:/content.txt")

' Variation 2
Save.ListViewContentCustom(ListVew1, "C:/content.txt", "/*E*/", "/*C*/")

Go to top

b. ListViewContentXML

This function is available in version 2.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The ListViewContentXML() method allows you to save a listview's content into a XML file. We recommend that you use these following parameters for your ListView:

  • Details vue mode
  • FullRowSelect = true

It has two arguments:

ValueArgumentDescription
ListViewlistViewListView where it's content needs to be saved
stringfilePathFile location where to save the ListView's content

Here's an example of usage:

C#

Save.ListViewContentXML(listView1, "C:/test.xml");

VB

Save.ListViewContentXML(listView1, "C:/test.xml")

Input:

Column 1Column 2Column 3
Test 1Test 2Test 3
Test 4Test 5Test 6
Test 7Test 8Test 9

Expected Output:

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ArrayOfString>
    <string>Test1</string>
    <string>Test2</string>
    <string>Test3</string>
  </ArrayOfString>
  <ArrayOfString>
    <string>Test4</string>
    <string>Test5</string>
    <string>Test6</string>
  </ArrayOfString>
  <ArrayOfString>
    <string>Test7</string>
    <string>Test8</string>
    <string>Test9</string>
  </ArrayOfString>
</ArrayOfArrayOfString>

Go to top

c. ListViewContentJSON

This function is available in version 2.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The ListViewContentJSON() method allows you to save a listview's content. We recommend that you use these following parameters for your ListView:

  • Details vue mode
  • FullRowSelect = true

It has two arguments:

ValueArgumentDescription
ListViewlistViewListView where it's content needs to be saved
stringfilePathFile location where to save the ListView's content

Here's an example of usage:

C#

Save.ListViewContentJSON(listView1, "C:/test.json");

VB

Save.ListViewContentJSON(listView1, "C:/test.json")

Input:

Column 1Column 2Column 3
Test 1Test 2Test 3
Test 4Test 5Test 6
Test 7Test 8Test 9

Expected Output:

[
    [
        "Test1",
        "Test2",
        "Test3"
    ],
    [
        "Test4",
        "Test5",
        "Test6"
    ],
    [
        "Test7",
        "Test8",
        "Test9"
    ]
]

Go to top