Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Center_Vertical_Horizontal/Center_Vertical_Horizontal.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Center_Vertical_Horizontal.Output
{
class _
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Syncfusion.XlsIORenderer;
using Syncfusion.XlsIO;
using Syncfusion.Pdf;

namespace Center_Vertical_Horizontal
{
class Program
{
static void Main(string[] args)
{
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];

for (int i = 1; i <= 10; i++)
{
for (int j = 1; j <= 5; j++)
{
sheet.Range[i, j].Text = sheet.Range[i, j].AddressLocal;
}
}

foreach (IWorksheet worksheet in workbook.Worksheets)
{
worksheet.PageSetup.CenterHorizontally = true;
worksheet.PageSetup.CenterVertically = true;
}

XlsIORenderer renderer = new XlsIORenderer();

PdfDocument pdfDocument = renderer.ConvertToPDF(workbook);
pdfDocument.Save(Path.GetFullPath("Output/Output.pdf"));
}
}
}
}
Loading