Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试使用Fillo API将数据写入Excel工作表时出错_Java_Excel_Jdbc_Apache Poi - Fatal编程技术网

Java 尝试使用Fillo API将数据写入Excel工作表时出错

Java 尝试使用Fillo API将数据写入Excel工作表时出错,java,excel,jdbc,apache-poi,Java,Excel,Jdbc,Apache Poi,我的系统中安装了一个DB。我有一个“用户”表,有两列:用户名和密码。 我使用JDBC连接从数据库中检索值。 我正在使用FilloAPI将值写入excel工作表 但是,文件写入完成后,当我打开excel工作表时,我发现Fillo以一种不同寻常的方式写入数据: Username Password User1 User2 User3 Pwd1 Pwd2

我的系统中安装了一个DB。我有一个“用户”表,有两列:用户名和密码。 我使用JDBC连接从数据库中检索值。 我正在使用FilloAPI将值写入excel工作表

但是,文件写入完成后,当我打开excel工作表时,我发现Fillo以一种不同寻常的方式写入数据:

Username               Password



User1
User2
User3
                        Pwd1
                        Pwd2
                        Pwd3
很明显,开头有一些空行,“password”的数据与“username”不一致。我需要数据如下所示:

Username                Password
User1                   Pwd1
User2                   Pwd2
User3                   Pwd3
我的Fillo API代码:

Fillo f = new Fillo();
com.codoid.products.fillo.Connection c = f.getConnection("C:\\Users\\Test.xlsx");
//将“user1”写入excel工作表

String myQuery1 = "INSERT INTO "users"(username) VALUES('user1')";
c.executeUpdate(myQuery);
String myQuery2 = "INSERT INTO "users"(password) VALUES('pwd1')";
c.executeUpdate(myQuery);
//将所有“密码”写入excel工作表

String myQuery1 = "INSERT INTO "users"(username) VALUES('user1')";
c.executeUpdate(myQuery);
String myQuery2 = "INSERT INTO "users"(password) VALUES('pwd1')";
c.executeUpdate(myQuery);
代码中有什么错误?如果您能回答使用Fillo API解决此问题,我们将不胜感激。
否则,Apache POI API回答也将被排除在外。

插入将创建新行,因此每次插入都会创建新行。如果希望值位于同一行中,则应使用
插入到“用户”(用户名、密码)值('user1','pwd1')
或类似的内容。插入将创建新行,因此每次插入都会创建新行。如果希望值位于同一行中,则应使用
插入“用户”(用户名、密码)值('user1','pwd1')
或类似内容。