Skip to content

Commit 8762db1

Browse files
claudiamurialdoBeta Bot
authored andcommitted
Cherry pick branch 'genexuslabs:feat/excel-xls' into beta
1 parent e6ccc9e commit 8762db1

3 files changed

Lines changed: 42 additions & 1 deletion

File tree

dotnet/src/dotnetframework/GxOffice/poi/hssf/ExcelCells.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ public bool SetHyperlink(string value)
184184
{
185185
for (int i = 1; i <= cellCount; i++)
186186
{
187-
pCells[i].Hyperlink.Address = value;
187+
var hyperlink = pWorkbook.GetCreationHelper().CreateHyperlink(HyperlinkType.Url);
188+
hyperlink.Address = value;
189+
190+
pCells[i].Hyperlink = hyperlink;
188191
}
189192
return true;
190193
}

dotnet/test/DotNetCoreUnitTest/Excel/ExcelPoi2003Test.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,25 @@ public void TestSetCellValues()
279279
Assert.Equal("hola!", excel.GetCells(2, 1, 1, 1).Text);
280280
excel.Save();
281281
}
282+
[WindowsOnlyFact]
283+
284+
public void TestSetCellHyperlink()
285+
{
286+
ExcelSpreadsheetGXWrapper excel = Create("testSetCellHyperLink");
287+
excel.Autofit = true;
288+
excel.GetCells(1, 1, 1, 1).HyperlinkValue = "genexus.com";
289+
excel.GetCells(1, 1, 1, 1).Text = "GeneXus";
290+
291+
excel.Save();
292+
excel.Close();
293+
// Verify previous Excel Document
294+
excel = Open("testSetCellHyperLink");
295+
296+
Assert.Equal("genexus.com", excel.GetCells(1, 1, 1, 1).HyperlinkValue);
297+
298+
Assert.Equal("GeneXus", excel.GetCells(1, 1, 1, 1).Text);
299+
excel.Save();
300+
}
282301

283302
[WindowsOnlyFact]
284303

dotnet/test/DotNetCoreUnitTest/Excel/ExcelPoiTest.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,25 @@ public void TestSetCellValues()
279279
Assert.Equal("hola!", excel.GetCells(2, 1, 1, 1).Text);
280280
excel.Save();
281281
}
282+
[WindowsOnlyFact]
283+
284+
public void TestSetCellHyperlink()
285+
{
286+
ExcelSpreadsheetGXWrapper excel = Create("testSetCellHyperLink");
287+
excel.Autofit = true;
288+
excel.GetCells(1, 1, 1, 1).HyperlinkValue = "genexus.com";
289+
excel.GetCells(1, 1, 1, 1).Text = "GeneXus";
290+
291+
excel.Save();
292+
excel.Close();
293+
// Verify previous Excel Document
294+
excel = Open("testSetCellHyperLink");
295+
296+
Assert.Equal("genexus.com", excel.GetCells(1, 1, 1, 1).HyperlinkValue);
297+
298+
Assert.Equal("GeneXus", excel.GetCells(1, 1, 1, 1).Text);
299+
excel.Save();
300+
}
282301

283302
[WindowsOnlyFact]
284303

0 commit comments

Comments
 (0)