Skip to content
Merged
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
2 changes: 1 addition & 1 deletion dotnet/src/dotnetcore/GxExcel/GxExcel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="EPPlus" Version="4.5.3.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="8.0.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 8 additions & 1 deletion dotnet/src/dotnetcore/GxOffice/GxOffice.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\dotnetframework\GxOffice\Constants.cs" Link="Constants.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\ExcelCellGXWrapper.cs" Link="ExcelCellGXWrapper.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\ExcelFactory.cs" Link="ExcelFactory.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\ExcelSpreadsheetGXWrapper.cs" Link="ExcelSpreadsheetGXWrapper.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\ExcelWorksheetGXWrapper.cs" Link="ExcelWorksheetGXWrapper.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" />
Expand All @@ -19,6 +21,10 @@
<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\hssf\ExcelCells.cs" Link="poi\hssf\ExcelCells.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\poi\hssf\ExcelSpreadsheet.cs" Link="poi\hssf\ExcelSpreadsheet.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\poi\hssf\ExcelWorksheet.cs" Link="poi\hssf\ExcelWorksheet.cs" />
<Compile Include="..\..\dotnetframework\GxOffice\poi\hssf\StylesCache.cs" Link="poi\hssf\StylesCache.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" />
Expand All @@ -35,7 +41,7 @@


<ItemGroup>
<PackageReference Include="NPOI" Version="2.5.6" />
<PackageReference Include="NPOI" Version="2.7.3" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
</ItemGroup>

Expand All @@ -45,6 +51,7 @@

<ItemGroup>
<Folder Include="exception\" />
<Folder Include="poi\hssf\" />
<Folder Include="poi\xssf\" />
<Folder Include="style\" />
</ItemGroup>
Expand Down
60 changes: 60 additions & 0 deletions dotnet/src/dotnetframework/GxOffice/ExcelCellGXWrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using GeneXus.MSOffice.Excel.Style;

namespace GeneXus.MSOffice.Excel
{

public class ExcelCellGXWrapper : IExcelCellRange
{
IExcelCellRange _value;
public ExcelCellGXWrapper(IExcelCellRange value) {
_value = value;
}
public ExcelCellGXWrapper()
{
System.Diagnostics.Debugger.Launch();
}

public int RowStart => _value.RowStart;

public int RowEnd => _value.RowEnd;

public int ColumnStart => _value.ColumnStart;


public int ColumnEnd => _value.ColumnEnd;

public string ValueType => _value.ValueType;


public string Text { get => _value.Text; set => _value.Text=value; }
public decimal NumericValue { get => _value.NumericValue; set => _value.NumericValue=value; }
public DateTime DateValue { get => _value.DateValue; set => _value.DateValue=value; }
public string HyperlinkValue { get => _value.HyperlinkValue; set => _value.HyperlinkValue=value; }

public bool Empty()
{
return _value.Empty();
}

public string GetCellAdress()
{
return _value.GetCellAdress();
}

public ExcelStyle GetCellStyle()
{
return _value.GetCellStyle();
}

public bool MergeCells()
{
return _value.MergeCells();
}

public bool SetCellStyle(ExcelStyle style)
{
return _value.SetCellStyle(style);
}
}
}
9 changes: 6 additions & 3 deletions dotnet/src/dotnetframework/GxOffice/ExcelFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.IO;
using GeneXus.Application;
using GeneXus.MSOffice.Excel.Poi.Xssf;

namespace GeneXus.MSOffice.Excel
{
Expand All @@ -17,9 +16,13 @@ public static IExcelSpreadsheet Create(IGXError handler, string filePath, string
template = Path.IsPathRooted(template) ? template : Path.Combine(GxContext.StaticPhysicalPath(), template);
}

if (filePath.EndsWith(ExcelSpreadsheet.DefaultExtension) || string.IsNullOrEmpty(Path.GetExtension(filePath)))
if (filePath.EndsWith(GeneXus.MSOffice.Excel.Poi.Xssf.ExcelSpreadsheet.DefaultExtension) || string.IsNullOrEmpty(Path.GetExtension(filePath)))
{
return new ExcelSpreadsheet(handler, filePath, template);
return new GeneXus.MSOffice.Excel.Poi.Xssf.ExcelSpreadsheet(handler, filePath, template);
}
else if (filePath.EndsWith(GeneXus.MSOffice.Excel.Poi.Hssf.ExcelSpreadsheet.DefaultExtension))
{
return new GeneXus.MSOffice.Excel.Poi.Hssf.ExcelSpreadsheet(handler, filePath, template);
}
throw new ExcelDocumentNotSupported();
}
Expand Down
21 changes: 10 additions & 11 deletions dotnet/src/dotnetframework/GxOffice/ExcelSpreadsheetGXWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using GeneXus.MSOffice.Excel.Poi.Xssf;

namespace GeneXus.MSOffice.Excel
{
Expand Down Expand Up @@ -130,13 +129,13 @@ private bool SaveAsImpl(string newFileName, string password)
return ok;
}

public ExcelCells GetCell(int rowIdx, int colIdx)
public ExcelCellGXWrapper GetCell(int rowIdx, int colIdx)
{
if (Initialize())
{
try
{
return (ExcelCells)_document.GetCell(_currentWorksheet, rowIdx, colIdx);
return new ExcelCellGXWrapper((IExcelCellRange)_document.GetCell(_currentWorksheet, rowIdx, colIdx));
}
catch (ExcelException e)
{
Expand All @@ -158,13 +157,13 @@ public void SetError(string errorMsg, ExcelException e)
GXLogging.Error(logger, errorMsg);
}

public ExcelCells GetCells(int rowIdx, int colIdx, int rowCount, int colCount)
public ExcelCellGXWrapper GetCells(int rowIdx, int colIdx, int rowCount, int colCount)
{
if (Initialize())
{
try
{
return (ExcelCells)_document.GetCells(_currentWorksheet, rowIdx, colIdx, rowCount, colCount);
return new ExcelCellGXWrapper((IExcelCellRange)_document.GetCells(_currentWorksheet, rowIdx, colIdx, rowCount, colCount));
}
catch (ExcelException e)
{
Expand Down Expand Up @@ -193,7 +192,7 @@ public bool SetCurrentWorksheetByName(string sheetName)
{
if (Initialize())
{
ExcelWorksheet ws = _document.GetWorkSheet(sheetName);
IExcelWorksheet ws = _document.GetWorkSheet(sheetName);
if (ws != null)
{
_currentWorksheet = ws;
Expand Down Expand Up @@ -292,7 +291,7 @@ public bool DeleteSheet(string sheetName)
{
if (Initialize())
{
ExcelWorksheet ws = _document.GetWorkSheet(sheetName);
IExcelWorksheet ws = _document.GetWorkSheet(sheetName);
if (ws != null)
return _document.DeleteSheet(sheetName);
}
Expand Down Expand Up @@ -340,24 +339,24 @@ private void SetError(int error, string description)

public string ErrDescription => _errDescription;

public ExcelWorksheet CurrentWorksheet
public ExcelWorksheetGXWrapper CurrentWorksheet
{
get
{
if (Initialize())
{
return (ExcelWorksheet)_currentWorksheet;
return new ExcelWorksheetGXWrapper(_currentWorksheet);
}
return null;
}
}

public List<ExcelWorksheet> GetWorksheets()
public List<IExcelWorksheet> GetWorksheets()
{
if (Initialize())
return _document.GetWorksheets();
else
return new List<ExcelWorksheet>();
return new List<IExcelWorksheet>();
}

private bool SelectFirstDefaultSheet(string sheetName)
Expand Down
38 changes: 38 additions & 0 deletions dotnet/src/dotnetframework/GxOffice/ExcelWorksheetGXWrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace GeneXus.MSOffice.Excel
{
public class ExcelWorksheetGXWrapper : IExcelWorksheet
{
private IExcelWorksheet _value;

public ExcelWorksheetGXWrapper(IExcelWorksheet value)
{
_value = value;
}

public ExcelWorksheetGXWrapper()
{
}

public string Name
{
get => _value.Name;
}

public bool Hidden { get => _value.Hidden; set => _value.Hidden=value; }

public bool Rename(string newName)
{
return _value.Rename(newName);
}

public bool Copy(string newName)
{
return _value.Copy(newName);
}

public void SetProtected(string password)
{
_value.SetProtected(password);
}
}
}
2 changes: 1 addition & 1 deletion dotnet/src/dotnetframework/GxOffice/GxOffice.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EPPlus" Version="4.5.3.2" />
<PackageReference Include="NPOI" Version="2.6.0" />
<PackageReference Include="NPOI" Version="2.7.3" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
</ItemGroup>

Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/dotnetframework/GxOffice/IExcelCellRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public interface IExcelCellRange

decimal NumericValue { get; set; }

string HyperlinkValue { get; set; }

DateTime DateValue { get; set; }

bool Empty();
Expand Down
5 changes: 2 additions & 3 deletions dotnet/src/dotnetframework/GxOffice/IExcelSpreadsheet.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using GeneXus.MSOffice.Excel.Poi.Xssf;

namespace GeneXus.MSOffice.Excel
{
Expand All @@ -18,8 +17,8 @@ public interface IExcelSpreadsheet
bool DeleteColumn(IExcelWorksheet worksheet, int colIdx);

// Worksheets
List<ExcelWorksheet> GetWorksheets();
ExcelWorksheet GetWorkSheet(string name);
List<IExcelWorksheet> GetWorksheets();
IExcelWorksheet GetWorkSheet(string name);
bool InsertWorksheet(string newSheetName, int idx);
bool Autofit { set; }
void SetColumnWidth(IExcelWorksheet worksheet, int colIdx, int width);
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/dotnetframework/GxOffice/IExcelWorksheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public interface IExcelWorksheet
{
string Name { get; }

bool Hidden { get; }
bool Hidden { get; set; }

bool Rename(string newName);
bool Copy(string newName);
Expand Down
Loading
Loading