Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Genexus Office module implementation using NPoi #832

Merged
merged 9 commits into from
Jul 4, 2023
26 changes: 23 additions & 3 deletions dotnet/DotNetStandardClasses.sln
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCoreOpenTelemetryTest
{5937CEC2-5C16-4650-B0E6-78CD34357384} = {5937CEC2-5C16-4650-B0E6-78CD34357384}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "test\TestApp\TestApp.csproj", "{5937CEC2-5C16-4650-B0E6-78CD34357384}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp", "test\TestApp\TestApp.csproj", "{5937CEC2-5C16-4650-B0E6-78CD34357384}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GxOffice", "src\dotnetframework\GxOffice\GxOffice.csproj", "{0CD32C8A-496A-46A2-9270-8B03421BADA2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "excel", "excel", "{BE108BE8-805D-4FCF-86BA-B2EAF581FFB2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GxOffice", "src\dotnetcore\GxOffice\GxOffice.csproj", "{E1CD114A-F8A5-4246-B5E3-FD27EDEC7C82}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "excel", "excel", "{B521FF6D-E081-4DE6-AC00-A9BE3B6439D1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -569,6 +577,14 @@ Global
{5937CEC2-5C16-4650-B0E6-78CD34357384}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5937CEC2-5C16-4650-B0E6-78CD34357384}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5937CEC2-5C16-4650-B0E6-78CD34357384}.Release|Any CPU.Build.0 = Release|Any CPU
{0CD32C8A-496A-46A2-9270-8B03421BADA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CD32C8A-496A-46A2-9270-8B03421BADA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CD32C8A-496A-46A2-9270-8B03421BADA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CD32C8A-496A-46A2-9270-8B03421BADA2}.Release|Any CPU.Build.0 = Release|Any CPU
{E1CD114A-F8A5-4246-B5E3-FD27EDEC7C82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1CD114A-F8A5-4246-B5E3-FD27EDEC7C82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1CD114A-F8A5-4246-B5E3-FD27EDEC7C82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1CD114A-F8A5-4246-B5E3-FD27EDEC7C82}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -586,8 +602,8 @@ Global
{792980F3-3B4D-4F20-8802-271644DEE48C} = {2261B65E-3757-4E5B-9DCD-EAE8D1E236A3}
{99750990-6CBB-4188-80FA-4C2CD1FB1AE9} = {F900A4AD-7249-41B4-B918-CB9E8C73747C}
{3C1D57CC-9715-4698-8974-FF578A9F5F48} = {F900A4AD-7249-41B4-B918-CB9E8C73747C}
{54982BA3-AC0A-4074-98ED-A1A61DD09224} = {F900A4AD-7249-41B4-B918-CB9E8C73747C}
{89FD9EC5-E490-4BB9-9A7F-C4BE87E62381} = {2261B65E-3757-4E5B-9DCD-EAE8D1E236A3}
{54982BA3-AC0A-4074-98ED-A1A61DD09224} = {BE108BE8-805D-4FCF-86BA-B2EAF581FFB2}
{89FD9EC5-E490-4BB9-9A7F-C4BE87E62381} = {B521FF6D-E081-4DE6-AC00-A9BE3B6439D1}
{A92C9C85-407B-4A89-A861-8CAEC695723E} = {F900A4AD-7249-41B4-B918-CB9E8C73747C}
{651C8B51-B5D5-48DC-9B61-19883254D2F2} = {2261B65E-3757-4E5B-9DCD-EAE8D1E236A3}
{FDD63DB8-FAEB-4808-8B7D-B2D9E4617E5C} = {F1E13DF4-9F50-41A2-9DC3-04B673B21032}
Expand Down Expand Up @@ -681,6 +697,10 @@ Global
{7AD4B13D-FA17-489B-9721-C00BCB6A3F2C} = {BBE020D4-C0FF-41A9-9EB1-D1EE12CC4BB8}
{B040A39A-53DC-4514-BE7F-A275FE1355FF} = {1D6F1776-FF4B-46C2-9B3D-BC46CCF049DC}
{5937CEC2-5C16-4650-B0E6-78CD34357384} = {1D6F1776-FF4B-46C2-9B3D-BC46CCF049DC}
{0CD32C8A-496A-46A2-9270-8B03421BADA2} = {BE108BE8-805D-4FCF-86BA-B2EAF581FFB2}
{BE108BE8-805D-4FCF-86BA-B2EAF581FFB2} = {F900A4AD-7249-41B4-B918-CB9E8C73747C}
{E1CD114A-F8A5-4246-B5E3-FD27EDEC7C82} = {B521FF6D-E081-4DE6-AC00-A9BE3B6439D1}
{B521FF6D-E081-4DE6-AC00-A9BE3B6439D1} = {2261B65E-3757-4E5B-9DCD-EAE8D1E236A3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E18684C9-7D76-45CD-BF24-E3944B7F174C}
Expand Down
52 changes: 52 additions & 0 deletions dotnet/src/dotnetcore/GxOffice/GxOffice.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<DefineConstants>NETCORE</DefineConstants>
<AssemblyName>Genexus.Office</AssemblyName>
<RootNamespace>GxOffice</RootNamespace>
<PackageTags>Office Excel Poi</PackageTags>
<PackageId>GeneXus.Office.Core</PackageId>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\dotnetframework\GxOffice\Constants.cs" Link="Constants.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\ExcelFactory.cs" Link="ExcelFactory.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\ExcelSpreadsheetGXWrapper.cs" Link="ExcelSpreadsheetGXWrapper.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\exception\ExcelDocumentNotSupported.cs" Link="exception\ExcelDocumentNotSupported.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\exception\ExcelException.cs" Link="exception\ExcelException.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\exception\ExcelReadonlyException.cs" Link="exception\ExcelReadonlyException.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\exception\ExcelTemplateNotFoundException.cs" Link="exception\ExcelTemplateNotFoundException.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\IExcelCellRange.cs" Link="IExcelCellRange.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\IExcelSpreadsheet.cs" Link="IExcelSpreadsheet.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\IExcelWorksheet.cs" Link="IExcelWorksheet.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\IGXError.cs" Link="IGXError.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\poi\xssf\ExcelCells.cs" Link="poi\xssf\ExcelCells.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\poi\xssf\ExcelSpreadsheet.cs" Link="poi\xssf\ExcelSpreadsheet.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\poi\xssf\ExcelWorksheet.cs" Link="poi\xssf\ExcelWorksheet.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\poi\xssf\StylesCache.cs" Link="poi\xssf\StylesCache.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\style\ExcelAlignment.cs" Link="style\ExcelAlignment.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\style\ExcelBorder.cs" Link="style\ExcelBorder.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\style\ExcelCellBorder.cs" Link="style\ExcelCellBorder.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\style\ExcelColor.cs" Link="style\ExcelColor.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\style\ExcelFill.cs" Link="style\ExcelFill.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\style\ExcelFont.cs" Link="style\ExcelFont.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\style\ExcelStyle.cs" Link="style\ExcelStyle.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\style\ExcelStyleDimension.cs" Link="style\ExcelStyleDimension.cs" />
</ItemGroup>


<ItemGroup>
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="NPOI" Version="2.5.6" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GxClasses\GxClasses.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="exception\" />
<Folder Include="poi\xssf\" />
<Folder Include="style\" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions dotnet/src/dotnetframework/GxOffice/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace GeneXus.MSOffice.Excel
{
public static class Constants
{
public const bool EXTERNAL_PRIVATE_UPLOAD = true;
}
public static class ErrorCodes
{
public const int TEMPLATE_NOT_FOUND = 4;
public const int EXTENSION_NOT_SUPPORTED = 5;
public const int FILE_NOT_SAVED = 6;
public const int FILE_EXCEPTION = 7;
}
}
27 changes: 27 additions & 0 deletions dotnet/src/dotnetframework/GxOffice/ExcelFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.IO;
using GeneXus.Application;
using GeneXus.MSOffice.Excel.Poi.Xssf;

namespace GeneXus.MSOffice.Excel
{
public class ExcelFactory
{
public static IExcelSpreadsheet Create(IGXError handler, string filePath, string template)
{
if (!string.IsNullOrEmpty(filePath))
{
filePath = Path.IsPathRooted(filePath) ? filePath : Path.Combine(GxContext.StaticPhysicalPath(), filePath);
}
if (!string.IsNullOrEmpty(template))
{
template = Path.IsPathRooted(template) ? template : Path.Combine(GxContext.StaticPhysicalPath(), template);
}

if (filePath.EndsWith(ExcelSpreadsheet.DefaultExtension) || string.IsNullOrEmpty(Path.GetExtension(filePath)))
{
return new ExcelSpreadsheet(handler, filePath, template);
}
throw new ExcelDocumentNotSupported();
}
}
}
Loading