I'm attempting to add a Hyperlink to a Table and need some guidance on how to implement correctly. Below is the method that I'm using that I modified from another post. When it runs it appears to add the row correctly however all I see are blank lines in the cells that contain the Hyperlinks.
01.
private
TableRow AddNewRow(
object
[] items)
02.
{
03.
TableRow newRow =
new
TableRow();
04.
for
(
int
i = 0; i < items.Length; i++)
05.
{
06.
TableCell cell =
new
TableCell();
07.
Paragraph paragraph =
new
Paragraph();
08.
Span span =
new
Span();
09.
10.
if
(items[i]
is
string
)
11.
{
12.
var newString = items[i]
as
string
;
13.
if
(
string
.IsNullOrEmpty(newString)) newString =
"No available information"
;
14.
span.Text = newString;
15.
paragraph.Inlines.Add(span);
16.
}
17.
else
if
(items[i]
is
HyperlinkInfo)
18.
{
19.
var hyperlinkInfo = items[i]
as
HyperlinkInfo;
20.
HyperlinkRangeStart hyperlinkStart =
new
HyperlinkRangeStart();
21.
hyperlinkStart.HyperlinkInfo = hyperlinkInfo;
22.
HyperlinkRangeEnd hyperlinkEnd =
new
HyperlinkRangeEnd();
23.
hyperlinkEnd.PairWithStart(hyperlinkStart);
24.
span.Text = hyperlinkInfo.ToString();
25.
paragraph.Inlines.Add(hyperlinkStart);
26.
paragraph.Inlines.Add(hyperlinkEnd);
27.
}
28.
cell.Blocks.Add(paragraph);
29.
newRow.Cells.Add(cell);
30.
}
31.
return
newRow;
32.
}