Back to Devexpress

XlPictureHyperlink Class

corelibraries-devexpress-dot-export-dot-xl-05e65afb.md

latest3.7 KB
Original Source

XlPictureHyperlink Class

Represents a hyperlink associated with a picture.

Namespace : DevExpress.Export.Xl

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public class XlPictureHyperlink :
    XlHyperlinkBase
vb
Public Class XlPictureHyperlink
    Inherits XlHyperlinkBase

The following members return XlPictureHyperlink objects:

Remarks

An XlPictureHyperlink object for a particular IXlPicture is accessible by using the IXlPicture.HyperlinkClick property.

The following example illustrates how to add a hyperlink to a picture.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/excel-export-api-examples

csharp
// 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);
        }
    }
}
vb
' Create an exporter instance.
Dim exporter As IXlExporter = XlExport.CreateExporter(documentFormat)

' Create a new document.
Using document As IXlDocument = exporter.CreateDocument(stream)
    document.Options.Culture = CultureInfo.CurrentCulture

    ' Create a worksheet.
    Using sheet As IXlSheet = document.CreateSheet()

        ' Load a picture from a file and add a hyperlink to the picture.
        Using picture As IXlPicture = 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)
        End Using
    End Using
End Using

Inheritance

Object XlHyperlinkBase XlPictureHyperlink

See Also

XlPictureHyperlink Members

Use the Excel Export API to Add a Hyperlink to a Picture

DevExpress.Export.Xl Namespace