Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Edited Unassigned: I'm having issue creating hyperlink to cell in another sheet [15582]

$
0
0
This is the code to try it out:
```
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExcelHyperlinkTest
{
class Program
{
static void Main(string[] args)
{
MemoryStream excelStream = new MemoryStream();
ExcelPackage excelFile = new ExcelPackage(excelStream);

ExcelWorksheet wsSrc = excelFile.Workbook.Worksheets.Add("src");
ExcelWorksheet wsTgt = excelFile.Workbook.Worksheets.Add("tgt");

wsSrc.Cells[1, 1].Formula = string.Format("HYPERLINK(\"#'{0}'!R{1}C{2}\";\"{3}\")", "tgt", 2, 5, "test"); //FormulaR1C1

excelFile.Save();
excelStream.Position = 0;

using (FileStream file = new FileStream("c:\\linkTest.xlsx", FileMode.Create, System.IO.FileAccess.Write))
{
byte[] bytes = new byte[excelStream.Length];
excelStream.Read(bytes, 0, (int)excelStream.Length);
file.Write(bytes, 0, bytes.Length);
excelStream.Close();
}
}
}
}
```


after i open excel file generated like this i get error

__we found a problem with some content in FILENAME do you want us to try to recover as much as we can
__

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>