-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f8b9a3
commit edf28ce
Showing
8 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...d/Get Row Height and Column Width in Pixels/Get Row Height and Column Width in Pixels.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34310.174 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Get Row Height and Column Width in Pixels", "Get Row Height and Column Width in Pixels\Get Row Height and Column Width in Pixels.csproj", "{2E122617-D2C7-4102-AF81-CEDA4F7F77BC}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2E122617-D2C7-4102-AF81-CEDA4F7F77BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2E122617-D2C7-4102-AF81-CEDA4F7F77BC}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2E122617-D2C7-4102-AF81-CEDA4F7F77BC}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{2E122617-D2C7-4102-AF81-CEDA4F7F77BC}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {6121E09A-8AC5-4FBC-99AB-85C44D57F5A6} | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+8.55 KB
... Column Width in Pixels/Get Row Height and Column Width in Pixels/Data/InputTemplate.xlsx
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
...et Row Height and Column Width in Pixels/Get Row Height and Column Width in Pixels.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Get_Row_Height_and_Column_Width_in_Pixels</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" /> | ||
</ItemGroup> | ||
|
||
</Project> |
32 changes: 32 additions & 0 deletions
32
...ow Height and Column Width in Pixels/Get Row Height and Column Width in Pixels/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Syncfusion.XlsIO; | ||
namespace Get_Row_Height_and_Column_Width_in_Pixels | ||
{ | ||
class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
using (ExcelEngine excelEngine = new ExcelEngine()) | ||
{ | ||
IApplication application = excelEngine.Excel; | ||
application.DefaultVersion = ExcelVersion.Xlsx; | ||
|
||
//Load an existing file | ||
FileStream inputStream = new FileStream("../../../Data/InputTemplate.xlsx", FileMode.Open); | ||
IWorkbook workbook = application.Workbooks.Open(inputStream); | ||
IWorksheet worksheet = workbook.Worksheets[0]; | ||
|
||
//Get row height in pixels | ||
int rowheight = worksheet.GetRowHeightInPixels(1); | ||
|
||
//Get column width in pixels | ||
int columnwidth = worksheet.GetColumnWidthInPixels(1); | ||
|
||
Console.WriteLine($"Row Height: {rowheight}"); | ||
Console.WriteLine($"Column Width: {columnwidth}"); | ||
|
||
//Dispose stream | ||
inputStream.Dispose(); | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...d/Set Row Height and Column Width in Pixels/Set Row Height and Column Width in Pixels.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34310.174 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set Row Height and Column Width in Pixels", "Set Row Height and Column Width in Pixels\Set Row Height and Column Width in Pixels.csproj", "{6B56B9B2-0F14-4C38-9ACE-AB023040D00A}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6B56B9B2-0F14-4C38-9ACE-AB023040D00A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6B56B9B2-0F14-4C38-9ACE-AB023040D00A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6B56B9B2-0F14-4C38-9ACE-AB023040D00A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6B56B9B2-0F14-4C38-9ACE-AB023040D00A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {5CC7961F-D80D-4D04-8877-C28AF652E914} | ||
EndGlobalSection | ||
EndGlobal |
Binary file added
BIN
+8.34 KB
... Column Width in Pixels/Set Row Height and Column Width in Pixels/Data/InputTemplate.xlsx
Binary file not shown.
34 changes: 34 additions & 0 deletions
34
...ow Height and Column Width in Pixels/Set Row Height and Column Width in Pixels/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Syncfusion.XlsIO; | ||
namespace Set_Row_Height_and_Column_width_in_pixels | ||
{ | ||
class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
using (ExcelEngine excelEngine = new ExcelEngine()) | ||
{ | ||
IApplication application = excelEngine.Excel; | ||
application.DefaultVersion = ExcelVersion.Xlsx; | ||
|
||
//Load an existing file | ||
FileStream inputStream = new FileStream("../../../Data/InputTemplate.xlsx", FileMode.Open); | ||
IWorkbook workbook = application.Workbooks.Open(inputStream); | ||
IWorksheet worksheet = workbook.Worksheets[0]; | ||
|
||
//Set row height in pixels | ||
worksheet.SetRowHeightInPixels(2, 50); | ||
|
||
//Get column width in pixels | ||
worksheet.SetColumnWidthInPixels(3, 100); | ||
|
||
//Save the workbook as stream | ||
FileStream outputStream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.Write); | ||
workbook.SaveAs(outputStream); | ||
|
||
//Dispose stream | ||
inputStream.Dispose(); | ||
outputStream.Dispose(); | ||
} | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...et Row Height and Column Width in Pixels/Set Row Height and Column Width in Pixels.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RootNamespace>Set_Row_Height_and_Column_Width_in_Pixels</RootNamespace> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="26.2.5" /> | ||
</ItemGroup> | ||
|
||
</Project> |