-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Genexus Office module implementation using NPoi (#832)
* Add Genexus Office module implementation using NPoi * Fix camel case on some namespaces. * Change .NET package name * Replace Get/Set methods by Properties. * Fix build error. * Uses NPOI 2.5.6 for package compatibility on System.Text.Encoding.CodePages, System.Security.Cryptography.Pkcs and System.Security.Cryptography.Xml. * Fix error "Offset and length were out of bounds for the array or count is greater .." when disposing ByteArrayInputStream. * ExcelSpreadsheet.Open("test.xlsx") on an existing file was locking the file so that the following &ExcelSpreadsheet.Save() failed. Replace FontHeight (which is in unit's of 1/20th of a point) by FontHeightInPoints which is in points. * Fix template path.
- Loading branch information
1 parent
efaaebc
commit 4488485
Showing
29 changed files
with
4,193 additions
and
3 deletions.
There are no files selected for viewing
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
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,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> |
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,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; | ||
} | ||
} |
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,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(); | ||
} | ||
} | ||
} |
Oops, something went wrong.