I’m having trouble in adding a hyperlink on a given cell in a table using aspose slides C#
Thank you for contacting support.
Please use the following code to create a presentation with the table with the hyperlink in the cell:
static void CreateTable()
{
// Create an instance of Presentation class
Presentation presentation = new Presentation();
// Get the first slide
ISlide slide = presentation.Slides[0];
// Define columns with widths and rows with heights
double[] dblCols = { 120, 120 };
double[] dblRows = { 100, 100 };
// Add table shape to slide
ITable tbl = slide.Shapes.AddTable(100, 50, dblCols, dblRows);
tbl[1, 0].TextFrame.Text = "10";
// Accessing the text frame
ITextFrame txtFrame = tbl[0, 0].TextFrame;
// Create the Paragraph object for text frame
IParagraph paragraph = txtFrame.Paragraphs[0];
// Create Portion object for paragraph
IPortion portion = paragraph.Portions[0];
portion.Text = "Text here";
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
//Adding hyperlink to the portion
portion.PortionFormat.HyperlinkClick = new Hyperlink("https://www.aspose.com/");
portion.PortionFormat.HyperlinkClick.Tooltip = "More than 70% Fortune 100 companies trust Aspose APIs";
portion.PortionFormat.FontHeight = 20;
// Save Presentation
presentation.Save("Add_Hyperlink_to_cell_out.pptx", SaveFormat.Pptx);
}
Please contact us, if you have any further questions.