public void TestURLsWithHashMark() { XSSFWorkbook wb = XSSFTestDataSamples.OpenSampleWorkbook("59775.xlsx"); XSSFSheet sh = wb.GetSheetAt(0) as XSSFSheet; CellAddress A2 = new CellAddress("A2"); CellAddress A3 = new CellAddress("A3"); CellAddress A4 = new CellAddress("A4"); CellAddress A7 = new CellAddress("A7"); XSSFHyperlink link = sh.GetHyperlink(A2) as XSSFHyperlink; Assert.AreEqual("address", "A2", link.CellRef); Assert.AreEqual(HyperlinkType.Url, link.Type, "link type"); Assert.AreEqual("http://twitter.com/#!/apacheorg", link.Address, "link target"); link = sh.GetHyperlink(A3) as XSSFHyperlink; Assert.AreEqual("address", "A3", link.CellRef); Assert.AreEqual(HyperlinkType.Url, link.Type, "link type"); Assert.AreEqual("http://www.bailii.org/databases.html#ie", link.Address, "link target"); link = sh.GetHyperlink(A4) as XSSFHyperlink; Assert.AreEqual("address", "A4", link.CellRef); Assert.AreEqual(HyperlinkType.Url, link.Type, "link type"); Assert.AreEqual("https://en.wikipedia.org/wiki/Apache_POI#See_also", link.Address, "link target"); link = sh.GetHyperlink(A7) as XSSFHyperlink; Assert.AreEqual("address", "A7", link.CellRef); Assert.AreEqual(HyperlinkType.Document, link.Type, "link type"); Assert.AreEqual("Sheet1", link.Address, "link target"); wb.Close(); }
public void Test52716() { XSSFWorkbook wb1 = XSSFTestDataSamples.OpenSampleWorkbook("52716.xlsx"); XSSFSheet sh1 = wb1.GetSheetAt(0) as XSSFSheet; XSSFWorkbook wb2 = XSSFTestDataSamples.WriteOutAndReadBack(wb1) as XSSFWorkbook; XSSFSheet sh2 = wb2.GetSheetAt(0) as XSSFSheet; Assert.AreEqual(sh1.NumberOfComments, sh2.NumberOfComments); XSSFHyperlink l1 = sh1.GetHyperlink(0, 1); Assert.AreEqual(HyperlinkType.Document, l1.Type); Assert.AreEqual("B1", l1.GetCellRef()); Assert.AreEqual("Sort on Titel", l1.Tooltip); XSSFHyperlink l2 = sh2.GetHyperlink(0, 1); Assert.AreEqual(l1.Tooltip, l2.Tooltip); Assert.AreEqual(HyperlinkType.Document, l2.Type); Assert.AreEqual("B1", l2.GetCellRef()); }
/// <summary> /// Get a Hyperlink in this sheet anchored at row, column /// </summary> /// <param name="row">The index of the row of the hyperlink, zero-based</param> /// <param name="column">the index of the column of the hyperlink, zero-based</param> /// <returns>return hyperlink if there is a hyperlink anchored at row, column; otherwise returns null</returns> public IHyperlink GetHyperlink(int row, int column) { return(_sh.GetHyperlink(row, column)); }