Esempio n. 1
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;
     }
 }
Esempio n. 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;
     }
 }
Esempio n. 3
0
        public void TestCreateFileRecord()
        {
            HyperlinkRecord link = new HyperlinkRecord();
            link.CreateFileLink();
            link.FirstRow = 0;
            link.LastRow = 0;
            link.Label = "file";
            link.ShortFilename = "link1.xls";

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