Skip to content

Commit 3dc52c1

Browse files
947645-AutofillExample
1 parent b1e944b commit 3dc52c1

File tree

16 files changed

+432
-0
lines changed

16 files changed

+432
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# How to autofill a series in a worksheet?
2+
3+
Step 1: Create a new C# Console Application project.
4+
5+
Step 2: Name the project.
6+
7+
Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).
8+
9+
Step 4: Include the following namespaces in the **Program.cs** file.
10+
11+
```csharp
12+
using System;
13+
using System.IO;
14+
using Syncfusion.XlsIO;
15+
```
16+
17+
Step 5: Include the below code snippet in **Program.cs** to autofill a series in a worksheet.
18+
19+
```csharp
20+
using (ExcelEngine excelEngine = new ExcelEngine())
21+
{
22+
IApplication application = excelEngine.Excel;
23+
application.DefaultVersion = ExcelVersion.Xlsx;
24+
IWorkbook workbook = application.Workbooks.Create(1);
25+
IWorksheet worksheet = workbook.Worksheets[0];
26+
27+
//Setting the values to the cells
28+
worksheet["A1"].Number = 1;
29+
worksheet["A2"].Number = 3;
30+
worksheet["A3"].Number = 5;
31+
32+
//Define the source range
33+
IRange source = worksheet["A1:A3"];
34+
35+
//Define the destination range
36+
IRange destinationRange = worksheet["A4:A10"];
37+
38+
//Use AutoFill method to fill the values based on ExcelAutoFillType
39+
source.AutoFill(destinationRange, ExcelAutoFillType.FillSeries);
40+
41+
//Saving the workbook as stream
42+
FileStream outputStream = new FileStream(Path.GetFullPath("Output.xlsx"), FileMode.Create, FileAccess.Write);
43+
workbook.SaveAs(outputStream);
44+
45+
//Dispose streams
46+
outputStream.Dispose();
47+
}
48+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36127.28 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DateTime FillSeries", "DateTime FillSeries\DateTime FillSeries.csproj", "{EA9A1164-D806-4836-AC67-CC2AF5816704}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.XlsIO.Portable_NET80", "..\..\..\..\..\xlsio\Portable\XlsIO.Portable\Src\Syncfusion.XlsIO.Portable_NET80.csproj", "{B1829367-CB57-24F6-0C45-DBCA10D321FF}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.Compression.Portable_NET80", "..\..\..\..\..\compression\Portable\Compression.Portable\Src\Syncfusion.Compression.Portable_NET80.csproj", "{652B9342-F913-C1BF-A30E-31072C9225F7}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{EA9A1164-D806-4836-AC67-CC2AF5816704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{EA9A1164-D806-4836-AC67-CC2AF5816704}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{EA9A1164-D806-4836-AC67-CC2AF5816704}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{EA9A1164-D806-4836-AC67-CC2AF5816704}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{B1829367-CB57-24F6-0C45-DBCA10D321FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{B1829367-CB57-24F6-0C45-DBCA10D321FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{B1829367-CB57-24F6-0C45-DBCA10D321FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{B1829367-CB57-24F6-0C45-DBCA10D321FF}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{652B9342-F913-C1BF-A30E-31072C9225F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{652B9342-F913-C1BF-A30E-31072C9225F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{652B9342-F913-C1BF-A30E-31072C9225F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{652B9342-F913-C1BF-A30E-31072C9225F7}.Release|Any CPU.Build.0 = Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {FAD9B7EE-3BB0-4977-8762-A415698A72BB}
36+
EndGlobalSection
37+
EndGlobal
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>DateTime_FillSeries</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\..\..\..\..\..\compression\Portable\Compression.Portable\Src\Syncfusion.Compression.Portable_NET80.csproj" />
13+
<ProjectReference Include="..\..\..\..\..\..\xlsio\Portable\XlsIO.Portable\Src\Syncfusion.XlsIO.Portable_NET80.csproj" />
14+
</ItemGroup>
15+
16+
</Project>

Worksheet Features/Fill Series/.NET/DateTime FillSeries/DateTime FillSeries/Output/.gitkeep

Whitespace-only changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Syncfusion.XlsIO;
2+
3+
class Program
4+
{
5+
public static void Main(string[] args)
6+
{
7+
using (ExcelEngine excelEngine = new ExcelEngine())
8+
{
9+
IApplication application = excelEngine.Excel;
10+
application.DefaultVersion = ExcelVersion.Xlsx;
11+
IWorkbook workbook = application.Workbooks.Create(1);
12+
IWorksheet worksheet = workbook.Worksheets[0];
13+
14+
//Setting the values to the cells
15+
worksheet["A1"].DateTime = new DateTime(2025, 1, 1);
16+
17+
//Define the range
18+
IRange range = worksheet["A1:A10"];
19+
20+
//Use FillSeries method to fill the values based on ExcelFillSeries
21+
range.FillSeries(ExcelSeriesBy.Columns, ExcelFillSeries.Years, 3, new DateTime(2060, 1, 1));
22+
23+
//Saving the workbook
24+
FileStream outputStream = new FileStream(Path.GetFullPath("Output.xlsx"), FileMode.Create, FileAccess.Write);
25+
workbook.SaveAs(outputStream);
26+
27+
//Dispose streams
28+
outputStream.Dispose();
29+
}
30+
31+
}
32+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# How to fill a date series in a worksheet?
2+
3+
Step 1: Create a new C# Console Application project.
4+
5+
Step 2: Name the project.
6+
7+
Step 3: Install the [Syncfusion.XlsIO.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core) NuGet package as reference to your .NET Standard applications from [NuGet.org](https://www.nuget.org).
8+
9+
Step 4: Include the following namespaces in the **Program.cs** file.
10+
11+
```csharp
12+
using System;
13+
using System.IO;
14+
using Syncfusion.XlsIO;
15+
```
16+
17+
Step 5: Include the below code snippet in **Program.cs** to fill a date series in a worksheet.
18+
```csharp
19+
using (ExcelEngine excelEngine = new ExcelEngine())
20+
{
21+
IApplication application = excelEngine.Excel;
22+
application.DefaultVersion = ExcelVersion.Xlsx;
23+
IWorkbook workbook = application.Workbooks.Create(1);
24+
IWorksheet worksheet = workbook.Worksheets[0];
25+
26+
//Setting the values to the cells
27+
worksheet["A1"].DateTime = new DateTime(2025, 1, 1);
28+
29+
//Define the range
30+
IRange range = worksheet["A1:A10"];
31+
32+
//Use FillSeries method to fill the values based on ExcelFillSeries
33+
range.FillSeries(ExcelSeriesBy.Columns, ExcelFillSeries.Years, 3, new DateTime(2060, 1, 1));
34+
35+
//Saving the workbook
36+
FileStream outputStream = new FileStream(Path.GetFullPath("Output.xlsx"), FileMode.Create, FileAccess.Write);
37+
workbook.SaveAs(outputStream);
38+
39+
//Dispose streams
40+
outputStream.Dispose();
41+
}
42+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36127.28 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FillSeries by Enabling Trend", "FillSeries by Enabling Trend\FillSeries by Enabling Trend.csproj", "{B94BB8DF-E6D3-4F7B-B908-E8DDB53E9FF2}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.XlsIO.Portable_NET80", "..\..\..\..\..\xlsio\Portable\XlsIO.Portable\Src\Syncfusion.XlsIO.Portable_NET80.csproj", "{B1829367-CB57-24F6-0C45-DBCA10D321FF}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.Compression.Portable_NET80", "..\..\..\..\..\compression\Portable\Compression.Portable\Src\Syncfusion.Compression.Portable_NET80.csproj", "{652B9342-F913-C1BF-A30E-31072C9225F7}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{B94BB8DF-E6D3-4F7B-B908-E8DDB53E9FF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{B94BB8DF-E6D3-4F7B-B908-E8DDB53E9FF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{B94BB8DF-E6D3-4F7B-B908-E8DDB53E9FF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{B94BB8DF-E6D3-4F7B-B908-E8DDB53E9FF2}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{B1829367-CB57-24F6-0C45-DBCA10D321FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{B1829367-CB57-24F6-0C45-DBCA10D321FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{B1829367-CB57-24F6-0C45-DBCA10D321FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{B1829367-CB57-24F6-0C45-DBCA10D321FF}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{652B9342-F913-C1BF-A30E-31072C9225F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{652B9342-F913-C1BF-A30E-31072C9225F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{652B9342-F913-C1BF-A30E-31072C9225F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{652B9342-F913-C1BF-A30E-31072C9225F7}.Release|Any CPU.Build.0 = Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {45D78520-D413-42CC-B68D-09C8135BDEE5}
36+
EndGlobalSection
37+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>FillSeries_by_Enabling_Trend</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\..\..\..\..\..\compression\Portable\Compression.Portable\Src\Syncfusion.Compression.Portable_NET80.csproj" />
13+
<ProjectReference Include="..\..\..\..\..\..\xlsio\Portable\XlsIO.Portable\Src\Syncfusion.XlsIO.Portable_NET80.csproj" />
14+
</ItemGroup>
15+
16+
</Project>

Worksheet Features/Fill Series/.NET/FillSeries by Enabling Trend/FillSeries by Enabling Trend/Output/.gitkeep

Whitespace-only changes.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Syncfusion.XlsIO;
2+
3+
class Program
4+
{
5+
public static void Main(string[] args)
6+
{
7+
using (ExcelEngine excelEngine = new ExcelEngine())
8+
{
9+
IApplication application = excelEngine.Excel;
10+
application.DefaultVersion = ExcelVersion.Xlsx;
11+
IWorkbook workbook = application.Workbooks.Create(1);
12+
IWorksheet worksheet = workbook.Worksheets[0];
13+
14+
//Setting the values to the cells
15+
worksheet["A1"].Number = 1;
16+
worksheet["A2"].Number = 3;
17+
worksheet["A3"].Number = 2;
18+
19+
//Define the range
20+
IRange range = worksheet["A1:A10"];
21+
22+
//Use FillSeries method to fill the values by enabling trend
23+
range.FillSeries(ExcelSeriesBy.Columns, ExcelFillSeries.Linear, true);
24+
25+
//Saving the workbook
26+
FileStream outputStream = new FileStream(Path.GetFullPath("Output.xlsx"), FileMode.Create, FileAccess.Write);
27+
workbook.SaveAs(outputStream);
28+
29+
//Dispose streams
30+
outputStream.Dispose();
31+
}
32+
}
33+
}
34+

0 commit comments

Comments
 (0)