java操作excel 插入 读取 超链接

java操作excel 插入 读取 超链接
import com.smartxls.HyperLink;
import com.smartxls.WorkBook;

public class HyperlinkReadSample
{

    public static void main(String args[])
    {

        WorkBook workBook = new WorkBook();
        String version = workBook.getVersionString();
        System.out.println("Ver:" + version);
        try
        {
            workBook.read("..\\template\\book.xls");

            // get the first index from the current sheet
            HyperLink hyperLink = workBook.getHyperlink(0);
            if(hyperLink != null)
            {
                System.out.println(hyperLink.getType());
                System.out.println(hyperLink.getLinkURLString());
                System.out.println(hyperLink.getLinkShowString());
                System.out.println(hyperLink.getToolTipString());
                System.out.println(hyperLink.getRange());
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}

import com.smartxls.HyperLink;
import com.smartxls.WorkBook;

public class HyperlinkWriteSample
{

    public static void main(String args[])
    {
        WorkBook workBook = new WorkBook();
        try
        {
            //add a url link to F6
            workBook.addHyperlink(5,5,5,5,"http://www.smartxls.com/", HyperLink.kURLAbs,"Hello,web url hyperlink!");

            //add a file link to F7
            workBook.addHyperlink(6,5,6,5,"c:\\",HyperLink.kFileAbs,"file link");

            workBook.write(".\\link.xls");
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}

你可能感兴趣的:(java操作excel 插入 读取 超链接)