示例#1
0
文件: HSSFHyperlink.cs 项目: WPG/npoi
 /// <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;
     }
 }
示例#2
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;
     }
 }
示例#3
0
        public void TestCreateDocumentRecord()
        {
            HyperlinkRecord link = new HyperlinkRecord();
            link.CreateDocumentLink();
            link.FirstRow = 3;
            link.LastRow = 3;
            link.Label = "place";
            link.TextMark = "Sheet1!A1";

            byte[] tmp = link.Serialize();
            byte[] ser = new byte[tmp.Length - 4];
            Array.Copy(tmp, 4, ser, 0, ser.Length);
            //Assert.AreEqual(data4.Length, ser.Length);
            Assert.IsTrue(Arrays.Equals(data4, ser));
        }