IXlPicture.HyperlinkClick Property
Gets a hyperlink associated with the current IXlPicture object.
Namespace: DevExpress.Export.Xl
Assembly: DevExpress.Printing.v24.1.Core.dll
NuGet Package: DevExpress.Printing.Core
Declaration
Property Value
Type | Description |
---|---|
XlPictureHyperlink | An XlPictureHyperlink object that is a hyperlink associated with a picture in a worksheet. |
Remarks
The XlPictureHyperlink class represents a hyperlink attached to a picture. When end-users click such a picture, its related hyperlink navigates them to a specific location defined by the XlHyperlinkBase.TargetUri property.
For an example on how to associate a hyperlink with a picture, refer to the How to: Add a Hyperlink to a Picture document.
Example
Note
A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples
// Create an exporter instance.
IXlExporter exporter = XlExport.CreateExporter(documentFormat);
// Create a new document.
using (IXlDocument document = exporter.CreateDocument(stream))
{
document.Options.Culture = CultureInfo.CurrentCulture;
// Create a worksheet.
using (IXlSheet sheet = document.CreateSheet())
{
// Load a picture from a file and add a hyperlink to the picture.
using (IXlPicture picture = sheet.CreatePicture())
{
picture.SetImage(Image.FromFile(Path.Combine(imagesPath, "DevExpress.png")), ImageFormat.Png);
picture.HyperlinkClick.TargetUri = "https://www.devexpress.com/";
picture.HyperlinkClick.Tooltip = "Developer Express Inc.";
picture.SetTwoCellAnchor(new XlAnchorPoint(1, 1, 0, 0), new XlAnchorPoint(10, 5, 2, 15), XlAnchorType.TwoCell);
}
}
}