[12074] | 1 | /*******************************************************************************
|
---|
| 2 | * You may amend and distribute as you like, but don't remove this header!
|
---|
| 3 | *
|
---|
| 4 | * EPPlus provides server-side generation of Excel 2007/2010 spreadsheets.
|
---|
| 5 | * See http://www.codeplex.com/EPPlus for details.
|
---|
| 6 | *
|
---|
| 7 | * Copyright (C) 2011 Jan Källman
|
---|
| 8 | *
|
---|
| 9 | * This library is free software; you can redistribute it and/or
|
---|
| 10 | * modify it under the terms of the GNU Lesser General Public
|
---|
| 11 | * License as published by the Free Software Foundation; either
|
---|
| 12 | * version 2.1 of the License, or (at your option) any later version.
|
---|
| 13 |
|
---|
| 14 | * This library is distributed in the hope that it will be useful,
|
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 17 | * See the GNU Lesser General Public License for more details.
|
---|
| 18 | *
|
---|
| 19 | * The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
|
---|
| 20 | * If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
|
---|
| 21 | *
|
---|
| 22 | * All code and executables are provided "as is" with no warranty either express or implied.
|
---|
| 23 | * The author accepts no liability for any damage or loss of business that this product may cause.
|
---|
| 24 | *
|
---|
| 25 | * Code change notes:
|
---|
| 26 | *
|
---|
| 27 | * Author Change Date
|
---|
| 28 | * ******************************************************************************
|
---|
| 29 | * Jan Källman Added this class 2010-01-24
|
---|
| 30 | * Jan Källman License changed GPL-->LGPL 2011-12-27
|
---|
| 31 | *******************************************************************************/
|
---|
| 32 | using System;
|
---|
| 33 | using System.Collections.Generic;
|
---|
| 34 | using System.Text;
|
---|
| 35 |
|
---|
| 36 | namespace OfficeOpenXml
|
---|
| 37 | {
|
---|
| 38 | /// <summary>
|
---|
| 39 | /// HyperlinkClass
|
---|
| 40 | /// </summary>
|
---|
| 41 | public class ExcelHyperLink : Uri
|
---|
| 42 | {
|
---|
| 43 | /// <summary>
|
---|
| 44 | /// A new hyperlink with the specified URI
|
---|
| 45 | /// </summary>
|
---|
| 46 | /// <param name="uriString">The URI</param>
|
---|
| 47 | public ExcelHyperLink(string uriString) :
|
---|
| 48 | base(uriString)
|
---|
| 49 | {
|
---|
| 50 | OriginalUri = (Uri)this;
|
---|
| 51 | }
|
---|
| 52 | /// <summary>
|
---|
| 53 | /// A new hyperlink with the specified URI. This syntax is obsolete
|
---|
| 54 | /// </summary>
|
---|
| 55 | /// <param name="uriString">The URI</param>
|
---|
| 56 | /// <param name="dontEscape"></param>
|
---|
| 57 | [Obsolete("base constructor 'System.Uri.Uri(string, bool)' is obsolete: 'The constructor has been deprecated. Please use new ExcelHyperLink(string). The dontEscape parameter is deprecated and is always false.")]
|
---|
| 58 | public ExcelHyperLink(string uriString, bool dontEscape) :
|
---|
| 59 | base(uriString, dontEscape)
|
---|
| 60 | {
|
---|
| 61 | OriginalUri = (Uri)this;
|
---|
| 62 | }
|
---|
| 63 | /// <summary>
|
---|
| 64 | /// A new hyperlink with the specified URI and kind
|
---|
| 65 | /// </summary>
|
---|
| 66 | /// <param name="uriString">The URI</param>
|
---|
| 67 | /// <param name="uriKind">Kind (absolute/relative or indeterminate)</param>
|
---|
| 68 | public ExcelHyperLink(string uriString, UriKind uriKind) :
|
---|
| 69 | base(uriString, uriKind)
|
---|
| 70 | {
|
---|
| 71 | OriginalUri = (Uri)this;
|
---|
| 72 | }
|
---|
| 73 | /// <summary>
|
---|
| 74 | /// Sheet internal reference
|
---|
| 75 | /// </summary>
|
---|
| 76 | /// <param name="referenceAddress">Address</param>
|
---|
| 77 | /// <param name="display">Displayed text</param>
|
---|
| 78 | public ExcelHyperLink(string referenceAddress, string display) :
|
---|
| 79 | base("xl://internal") //URI is not used on internal links so put a dummy uri here.
|
---|
| 80 | {
|
---|
| 81 | _referenceAddress = referenceAddress;
|
---|
| 82 | _display = display;
|
---|
| 83 | }
|
---|
| 84 | string _referenceAddress = null;
|
---|
| 85 | /// <summary>
|
---|
| 86 | /// The Excel address for internal links.
|
---|
| 87 | /// </summary>
|
---|
| 88 | public string ReferenceAddress
|
---|
| 89 | {
|
---|
| 90 | get
|
---|
| 91 | {
|
---|
| 92 | return _referenceAddress;
|
---|
| 93 | }
|
---|
| 94 | set
|
---|
| 95 | {
|
---|
| 96 | _referenceAddress = value;
|
---|
| 97 | }
|
---|
| 98 | }
|
---|
| 99 | string _display = "";
|
---|
| 100 | /// <summary>
|
---|
| 101 | /// Displayed text
|
---|
| 102 | /// </summary>
|
---|
| 103 | public string Display
|
---|
| 104 | {
|
---|
| 105 | get
|
---|
| 106 | {
|
---|
| 107 | return _display;
|
---|
| 108 | }
|
---|
| 109 | set
|
---|
| 110 | {
|
---|
| 111 | _display = value;
|
---|
| 112 | }
|
---|
| 113 | }
|
---|
| 114 | /// <summary>
|
---|
| 115 | /// Tooltip
|
---|
| 116 | /// </summary>
|
---|
| 117 | public string ToolTip
|
---|
| 118 | {
|
---|
| 119 | get;
|
---|
| 120 | set;
|
---|
| 121 | }
|
---|
| 122 | int _colSpann = 0;
|
---|
| 123 | /// <summary>
|
---|
| 124 | /// If the hyperlink spans multiple columns
|
---|
| 125 | /// </summary>
|
---|
| 126 | public int ColSpann
|
---|
| 127 | {
|
---|
| 128 | get
|
---|
| 129 | {
|
---|
| 130 | return _colSpann;
|
---|
| 131 | }
|
---|
| 132 | set
|
---|
| 133 | {
|
---|
| 134 | _colSpann = value;
|
---|
| 135 | }
|
---|
| 136 | }
|
---|
| 137 | int _rowSpann = 0;
|
---|
| 138 | /// <summary>
|
---|
| 139 | /// If the hyperlink spans multiple rows
|
---|
| 140 | /// </summary>
|
---|
| 141 | public int RowSpann
|
---|
| 142 | {
|
---|
| 143 | get
|
---|
| 144 | {
|
---|
| 145 | return _rowSpann;
|
---|
| 146 | }
|
---|
| 147 | set
|
---|
| 148 | {
|
---|
| 149 | _rowSpann = value;
|
---|
| 150 | }
|
---|
| 151 | }
|
---|
| 152 | /// <summary>
|
---|
| 153 | /// Used to handle non absolute URI's.
|
---|
| 154 | /// Is used if IsAblsoluteUri is true. The base URI will have a dummy value of xl://nonAbsolute.
|
---|
| 155 | /// </summary>
|
---|
| 156 | public Uri OriginalUri
|
---|
| 157 | {
|
---|
| 158 | get;
|
---|
| 159 | internal set;
|
---|
| 160 | }
|
---|
| 161 | internal string RId
|
---|
| 162 | {
|
---|
| 163 | get;
|
---|
| 164 | set;
|
---|
| 165 | }
|
---|
| 166 | }
|
---|
| 167 | }
|
---|