作者:乔山办公网日期:
返回目录:excel表格制作
如下:e799bee5baa6e997aee7ad94e58685e5aeb9365
public static String do_post(String url, List<NameValuePair> name_value_pair) throws IOException {
String body = "{}";
DefaultHttpClient httpclient = new DefaultHttpClient();
try {
HttpPost httpost = new HttpPost(url);
httpost.setEntity(new UrlEncodedFormEntity(name_value_pair, StandardCharsets.UTF_8));
HttpResponse response = httpclient.execute(httpost);
HttpEntity entity = response.getEntity();
body = EntityUtils.toString(entity);
} finally {
httpclient.getConnectionManager().shutdown();
}
return body;
}
public static String do_get(String url) throws ClientProtocolException, IOException {
String body = "{}";
DefaultHttpClient httpclient = new DefaultHttpClient();
try {
HttpGet httpget = new HttpGet(url);
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
body = EntityUtils.toString(entity);
} finally {
httpclient.getConnectionManager().shutdown();
}
return body;
}
源码贴出来,我来帮你改。原因应该是你没把 合并后的单元格赋值导致的。看看poi的api文档。
比如第一行第一列到第4列合并,那么你合并后的编号就还是第一行第一列,就是给第一行第一列赋值就可以了
那你在循环着往Excel中写数据之前要先确定公司类型有多少,每个公司类型对应几条数据,如(n)。
然后在插入的时候第一个框就夸n行,接下来的n-1行就从第二个框开始插入。