示例#1
0
        public void TestCreateEmailtRecord()
        {
            HyperlinkRecord link = new HyperlinkRecord();

            link.CreateUrlLink();
            link.FirstRow = 1;
            link.LastRow  = 1;
            link.Label    = "email";
            link.Address  = "mailto:[email protected]?subject=Hello,%20Ebgans!";

            byte[] tmp = link.Serialize();
            byte[] ser = new byte[tmp.Length - 4];
            Array.Copy(tmp, 4, ser, 0, ser.Length);
            Assert.AreEqual(data3.Length, ser.Length);
            Assert.IsTrue(Arrays.Equals(data3, ser));
        }
示例#2
0
        public void TestCreateURLRecord()
        {
            HyperlinkRecord link = new HyperlinkRecord();

            link.CreateUrlLink();
            link.FirstRow = 2;
            link.LastRow  = 2;
            link.Label    = "My Link";
            link.Address  = "http://www.lakings.com/";

            byte[] tmp = link.Serialize();
            byte[] ser = new byte[tmp.Length - 4];
            Array.Copy(tmp, 4, ser, 0, ser.Length);
            Assert.AreEqual(data1.Length, ser.Length);
            Assert.IsTrue(Arrays.Equals(data1, ser));
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HSSFHyperlink"/> class.
        /// </summary>
        /// <param name="type">The type of hyperlink to Create.</param>
        public HSSFHyperlink(HyperlinkType type)
        {
            this.link_type = (int)type;
            record         = new HyperlinkRecord();
            switch (type)
            {
            case HyperlinkType.URL:
            case HyperlinkType.EMAIL:
                record.CreateUrlLink();
                break;

            case HyperlinkType.FILE:
                record.CreateFileLink();
                break;

            case HyperlinkType.DOCUMENT:
                record.CreateDocumentLink();
                break;
            }
        }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HSSFHyperlink"/> class.
        /// </summary>
        /// <param name="type">The type of hyperlink to Create.</param>
        public HSSFHyperlink(HyperlinkType type)
        {
            link_type = (int)type;
            record    = new HyperlinkRecord();
            switch (type)
            {
            case HyperlinkType.Url:
            case HyperlinkType.Email:
                record.CreateUrlLink();
                break;

            case HyperlinkType.File:
                record.CreateFileLink();
                break;

            case HyperlinkType.Document:
                record.CreateDocumentLink();
                break;
            }
        }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HSSFHyperlink"/> class.
        /// </summary>
        /// <param name="type">The type of hyperlink to Create.</param>
        public HSSFHyperlink(HyperlinkType type)
        {
            this.link_type = type;
            record         = new HyperlinkRecord();
            switch (type)
            {
            case HyperlinkType.Url:
            case HyperlinkType.Email:
                record.CreateUrlLink();
                break;

            case HyperlinkType.File:
                record.CreateFileLink();
                break;

            case HyperlinkType.Document:
                record.CreateDocumentLink();
                break;

            default:
                throw new ArgumentException("Invalid type: " + type);
            }
        }