Skip to content

Commit 988b356

Browse files
committed
Merge branch 'master' of https://github.com/aspose-cells/Aspose.Cells-for-.NET into master
2 parents 0f5674e + 61c15ad commit 988b356

File tree

5 files changed

+62
-69
lines changed

5 files changed

+62
-69
lines changed

Examples/CSharp/Articles/ManagingWorkbooksWorksheets/ExportExcelDataToDataTableWithoutFormatting.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public static void Run()
3131
// Display the cell values as it displays in excel
3232
Console.WriteLine("Cell String Value: " + cell.StringValue);
3333

34-
// Display the cell value without any format
35-
Console.WriteLine("Cell String Value without Format: " + cell.StringValueWithoutFormat);
34+
3635

3736
// Export Data Table Options with FormatStrategy as CellStyle
3837
ExportTableOptions opts = new ExportTableOptions();

Examples/CSharp/CSharp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
</PropertyGroup>
3838
<PropertyGroup />
3939
<ItemGroup>
40-
<Reference Include="Aspose.Cells, Version=20.10.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
41-
<HintPath>..\packages\Aspose.Cells.20.10.0\lib\net40\Aspose.Cells.dll</HintPath>
40+
<Reference Include="Aspose.Cells, Version=20.12.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
41+
<HintPath>..\packages\Aspose.Cells.20.12.0\lib\net40\Aspose.Cells.dll</HintPath>
4242
</Reference>
4343
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
4444
<Reference Include="Microsoft.VisualStudio.Tools.Applications.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />

Examples/CSharp/SmartMarkers/UsingGenericList.cs

Lines changed: 57 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,56 @@ namespace Aspose.Cells.Examples.CSharp.SmartMarkers
88
{
99
public class UsingGenericList
1010
{
11-
12-
public class Husband
13-
{
14-
private String m_Name;
15-
16-
public String Name
17-
{
18-
get { return m_Name; }
19-
set { m_Name = value; }
20-
}
21-
22-
private int m_Age;
2311

12+
public class Person
13+
{
14+
int _age;
15+
string _name;
2416
public int Age
2517
{
26-
get { return m_Age; }
27-
set { m_Age = value; }
18+
get
19+
{
20+
return _age;
21+
}
22+
set
23+
{
24+
_age = value;
25+
}
2826
}
29-
30-
internal Husband(string name, int age)
27+
public string Name
3128
{
32-
this.Name = name;
33-
this.Age = age;
29+
get
30+
{
31+
return _name;
32+
}
33+
set
34+
{
35+
_name = value;
36+
}
3437
}
3538

36-
// Accepting a generic List as a Nested Object
37-
private List<Wife> m_Wives;
38-
39-
public List<Wife> Wives
39+
public Person(string name, int age)
4040
{
41-
get { return m_Wives; }
42-
set { m_Wives = value; }
41+
_age = age;
42+
_name = name;
4343
}
44-
44+
// ExEnd:1
4545
}
4646

47-
public class Wife
47+
public class Teacher : Person
4848
{
49-
public Wife(string name, int age)
50-
{
51-
this.m_name = name;
52-
this.m_age = age;
53-
}
5449

55-
private string m_name;
5650

57-
public string Name
51+
public Teacher(string name, int age) : base(name, age)
5852
{
59-
get { return m_name; }
60-
set { m_name = value; }
53+
m_students = new List<Person>();
6154
}
62-
private int m_age;
55+
private IList<Person> m_students;
6356

64-
public int Age
57+
public IList<Person> Students
6558
{
66-
get { return m_age; }
67-
set { m_age = value; }
59+
get { return m_students; }
60+
set { m_students = value; }
6861
}
6962
}
7063

@@ -74,23 +67,23 @@ public static void Run()
7467
// The path to the documents directory.
7568
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
7669
Workbook workbook = new Workbook();
77-
70+
7871
// Create a designer workbook
7972

8073
// Workbook workbook = new Workbook();
8174
Worksheet worksheet = workbook.Worksheets[0];
8275

83-
worksheet.Cells["A1"].PutValue("Husband Name");
84-
worksheet.Cells["A2"].PutValue("&=Husband.Name");
76+
worksheet.Cells["A1"].PutValue("Teacher Name");
77+
worksheet.Cells["A2"].PutValue("&=Teacher.Name");
8578

86-
worksheet.Cells["B1"].PutValue("Husband Age");
87-
worksheet.Cells["B2"].PutValue("&=Husband.Age");
79+
worksheet.Cells["B1"].PutValue("Teacher Age");
80+
worksheet.Cells["B2"].PutValue("&=Teacher.Age");
8881

89-
worksheet.Cells["C1"].PutValue("Wife's Name");
90-
worksheet.Cells["C2"].PutValue("&=Husband.Wives.Name");
82+
worksheet.Cells["C1"].PutValue("Student Name");
83+
worksheet.Cells["C2"].PutValue("&=Teacher.Students.Name");
9184

92-
worksheet.Cells["D1"].PutValue("Wife's Age");
93-
worksheet.Cells["D2"].PutValue("&=Husband.Wives.Age");
85+
worksheet.Cells["D1"].PutValue("Student Age");
86+
worksheet.Cells["D2"].PutValue("&=Teacher.Students.Age");
9487

9588
// Apply Style to A1:D1
9689
Range range = worksheet.Cells.CreateRange("A1:D1");
@@ -108,32 +101,32 @@ public static void Run()
108101
// Load the template file
109102
designer.Workbook = workbook;
110103

111-
System.Collections.Generic.List<Husband> list = new System.Collections.Generic.List<Husband>();
104+
System.Collections.Generic.List<Teacher> list = new System.Collections.Generic.List<Teacher>();
112105

113-
// Create an object for the Husband class
114-
Husband h1 = new Husband("Mark John", 30);
106+
// Create an object for the Teacher class
107+
Teacher h1 = new Teacher("Mark John", 30);
115108

116-
// Create the relevant Wife objects for the Husband object
117-
h1.Wives = new List<Wife>();
118-
h1.Wives.Add(new Wife("Chen Zhao", 34));
119-
h1.Wives.Add(new Wife("Jamima Winfrey", 28));
120-
h1.Wives.Add(new Wife("Reham Smith", 35));
109+
// Create the relevant student objects for the Teacher object
110+
h1.Students = new List<Person>();
111+
h1.Students.Add(new Person("Chen Zhao", 14));
112+
h1.Students.Add(new Person("Jamima Winfrey", 18));
113+
h1.Students.Add(new Person("Reham Smith", 15));
121114

122-
// Create another object for the Husband class
123-
Husband h2 = new Husband("Masood Shankar", 40);
115+
// Create another object for the Teacher class
116+
Teacher h2 = new Teacher("Masood Shankar", 40);
124117

125-
// Create the relevant Wife objects for the Husband object
126-
h2.Wives = new List<Wife>();
127-
h2.Wives.Add(new Wife("Karishma Jathool", 36));
128-
h2.Wives.Add(new Wife("Angela Rose", 33));
129-
h2.Wives.Add(new Wife("Hina Khanna", 45));
118+
// Create the relevant student objects for the Teacher object
119+
h2.Students = new List<Person>();
120+
h2.Students.Add(new Person("Karishma Jathool", 16));
121+
h2.Students.Add(new Person("Angela Rose", 13));
122+
h2.Students.Add(new Person("Hina Khanna", 15));
130123

131124
// Add the objects to the list
132125
list.Add(h1);
133126
list.Add(h2);
134127

135128
// Specify the DataSource
136-
designer.SetDataSource("Husband", list);
129+
designer.SetDataSource("Teacher", list);
137130

138131
// Process the markers
139132
designer.Process();

Examples/CSharp/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Aspose.Cells" version="20.10.0" targetFramework="net40" />
3+
<package id="Aspose.Cells" version="20.12.0" targetFramework="net40" />
44
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net40" />
55
</packages>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
![Nuget](https://img.shields.io/nuget/v/Aspose.Cells) ![Nuget](https://img.shields.io/nuget/dt/Aspose.Cells) ![GitHub](https://img.shields.io/github/license/aspose-cells/Aspose.Cells-for-.NET)
12
# .NET API for Excel Files
23

34
[Aspose.Cells for .NET](https://products.aspose.com/cells/net) is an Excel Spreadsheet Programming API to speed up spreadsheet management and processing tasks. Excel .NET API supports to build cross-platform applications having the ability to generate, modify, convert, render and print spreadsheets.

0 commit comments

Comments
 (0)