小编new*_*ain的帖子

如何使用iText获取获取单元格值

这是一个Emp.xls表: -

+-------+-------------+---------------+--------+
| EmpId |  Name       | Designation   |  Salary|
+-------+-------------+---------------+--------+
|  1.0  |   Akon Roy  | project led   | 12000.0|
|  2.0  |   Brey Deo  | manager       | 13000.0|
|  3.0  |   Dean      | delivery head | 14000.0|
|  4.0  |   Clark     | team led      |155555.0|
+-------+-------------+---------------+--------+
Run Code Online (Sandbox Code Playgroud)

我的问题是我想创建一个PDF文件,输出结果如下: -

 Hello <name>,
Run Code Online (Sandbox Code Playgroud)

这里的名称可以是用户给出的Emp.xls记录中的任何名称.如何使用iTextApache poi解决这个问题.

我的代码是:

          public static void main(String[] args) {


        try {

            FileInputStream inputFile = new FileInputStream("E:\\Emp.xls"); …
Run Code Online (Sandbox Code Playgroud)

java excel itext apache-poi

2
推荐指数
1
解决办法
1665
查看次数

无法在catch块中处理RunTimeException

如果我在catch块中编写RunTimeException,那么为什么不处理它.

class main{
    public static void main(String cs[]){
        try{
            int a = 10/0;
        }
        catch(RunTimeException e){
            System.out.println("exception caught");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,如果我写RunTimeException会出现错误,如果我写了RunTimeException的子类,即ArithmaticException和超类Exception.

错误是

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
RunTimeException cannot be resolved to a type
Run Code Online (Sandbox Code Playgroud)

java exception-handling exception core

1
推荐指数
1
解决办法
1258
查看次数

标签 统计

java ×2

apache-poi ×1

core ×1

excel ×1

exception ×1

exception-handling ×1

itext ×1