当前位置:首页教育技巧excel技巧excel数据库

用问卷星导出的excel表格怎么改

2024-07-12 10:59:36


1.在手机上怎么把问卷星数据导出表格

需求描述将应用内的数据导出为excel表格。

实现添加依赖包在app的build.gradle里面添加依赖包:implementation group: 'net.sourceforge.jexcelapi', name: 'jxl', version: '2.6.12'有很多读者提到该依赖有问题,笔者推测是网络代理的问题,遇到这种问题大家可以到下载对应的jar包手动导入即可:如果还是不能成功笔者已经写好了jar包放在了,大家可以自由下载,下载到jar包之后将其放在app/libs目录下,然后右键jar包文件,然后Add as Library即可。编写excel工具类package cn.xiaojii.cashgift.util.io;import jxl.Workbook;import jxl.WorkbookSettings;import jxl.format.Colour;import jxl.write.Label;import jxl.write.WritableCell;import jxl.write.WritableCellFormat;import jxl.write.WritableFont;import jxl.write.WritableSheet;import jxl.write.WritableWorkbook;import jxl.write.WriteException;/** * @author dmrfcoder * @date 2018/8/9 */public class ExcelUtil { private static WritableFont arial14font = null; private static WritableCellFormat arial14format = null; private static WritableFont arial10font = null; private static WritableCellFormat arial10format = null; private static WritableFont arial12font = null; private static WritableCellFormat arial12format = null; private final static String UTF8_ENCODING = "UTF-8"; /** * 单元格的格式设置 字体大小 颜色 对齐方式、背景颜色等。

*/ private static void format() { try { arial14font = new WritableFont(WritableFont.ARIAL, 14, WritableFont.BOLD); arial14font.setColour(jxl.format.Colour.LIGHT_BLUE); arial14format = new WritableCellFormat(arial14font); arial14format.setAlignment(jxl.format.Alignment.CENTRE); arial14format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); arial14format.setBackground(jxl.format.Colour.VERY_LIGHT_YELLOW); arial10font = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD); arial10format = new WritableCellFormat(arial10font); arial10format.setAlignment(jxl.format.Alignment.CENTRE); arial10format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); arial10format.setBackground(Colour.GRAY_25); arial12font = new WritableFont(WritableFont.ARIAL, 10); arial12format = new WritableCellFormat(arial12font); //对齐格式 arial10format.setAlignment(jxl.format.Alignment.CENTRE); //设置边框 arial12format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); } catch (WriteException e) { e.printStackTrace(); } } /** * 初始化Excel * * @param fileName 导出excel存放的地址(目录) * @param colName excel中包含的列名(可以有多个) */ public static void initExcel(String fileName, String[] colName) { format(); WritableWorkbook workbook = null; try { File file = new File(fileName); if (!file.exists()) { file.createNewFile(); } workbook = Workbook.createWorkbook(file); //设置表格的名字 WritableSheet sheet = workbook.createSheet("账单", 0); //创建标题栏 sheet.addCell((WritableCell) new Label(0, 0, fileName, arial14format)); for (int col = 0; col < colName.length; col++) { sheet.addCell(new Label(col, 0, colName[col], arial10format)); } //设置行高 sheet.setRowView(0, 340); workbook.write(); } catch (Exception e) { e.printStackTrace(); } finally { if (workbook != null) { try { workbook.close(); } catch (Exception e) { e.printStackTrace(); } } } } @SuppressWarnings("unchecked") public static void writeObjListToExcel(List objList, String fileName, Context c) { if (objList != null && objList.size() > 0) { WritableWorkbook writebook = null; InputStream in = null; try { WorkbookSettings setEncode = new WorkbookSettings(); setEncode.setEncoding(UTF8_ENCODING); in = new FileInputStream(new File(fileName)); Workbook workbook = Workbook.getWorkbook(in); writebook = Workbook.createWorkbook(new File(fileName), workbook); WritableSheet sheet = writebook.getSheet(0); for (int j = 0; j < objList.size(); j++) { ProjectBean projectBean = (ProjectBean) objList.get(j); List list = new ArrayList<>(); list.add(projectBean.getName()); list.add(projectBean.getProject()); list.add(projectBean.getMoney()); list.add(projectBean.getYear() + " " + projectBean.getMonth()+" "+projectBean.getDay()); list.add(projectBean.getBeizhu()); for (int i = 0; i < list.size(); i++) { sheet.addCell(new Label(i, j + 1, list.get(i), arial12format)); if (list.get(i).length() <= 4) { //设置列宽 sheet.setColumnView(i, list.get(i).length() + 8); } else { //设置列宽 sheet.setColumnView(i, list.get(i).length() + 5); } } //设置行高 sheet.setRowView(j + 1, 350); } writebook.write(); Toast.makeText(c, "导出Excel成功", Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } finally { if (writebook != null) { try { writebook.close(); } catch (Exception e) { e.printStackTrace(); 。

2..net 求助关于 导出excel方法的修改 谢谢~!有代码

具体版本问题我还是不清楚,不过你代码的确一点不够规范,

public void CreateExcel(DataSet ds,string typeid,string FileName)

{

HttpResponse resp;

resp = Page.Response;

resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");

resp.AppendHeader("Content-Disposition", "attachment;filename=" + FileName);

string colHeaders= "", ls_item="";

int i=0;

//定义表对象与行对像,同时用DataSet对其值进行初始化

DataTable dt=ds.Tables[0];

DataRow[] myRow=dt.Select("");

// typeid=="1"时导出为EXCEL格式文件;typeid=="2"时导出为XML格式文件

if(typeid=="1")

{

//取得数据表各列标题,各标题之间以\t分割,最后一个列标题后加回车符

for(i=0;icolHeaders+=dt.Columns[i].Caption.ToString()+"\t";

colHeaders +=dt.Columns[i].Caption.ToString() +"\n";

//向HTTP输出流中写入取得的数据信息

resp.Write(colHeaders);

//逐行处理数据

foreach(DataRow row in myRow)

{

//在当前行中,逐列获得数据,数据之间以\t分割,结束时加回车符\n

for(i=0;ils_item +=row[i].ToString() + "\t";

ls_item += row[i].ToString() +"\n";

//当前行数据写入HTTP输出流,并且置空ls_item以便下行数据

resp.Write(ls_item);

ls_item="";

}

}

else

{

if(typeid=="2")

{

//从DataSet中直接导出XML数据并且写到HTTP输出流中

resp.Write(ds.GetXml());

}

}

//写缓冲区中的数据到HTTP头文件中

resp.End();

}

3.问卷星的数据应该如何导出

以电脑版本的问卷星为例,可以将该问卷保存为WEB档案格式的文件。然后再使用任意的浏览器打开该文件就可以进行选中复制和粘贴了。具体的操作方如下:

1、在电脑上打开问卷星的调查问卷。

2、在问卷界面中同时按下键盘上的CTRL和S,在出现的保存对话框中选择WEB单个文件点击保存。

3、此时可以看到已经保存在对应位置的该文件,双击打开该文件。

4、页面跳转以后进入到该保存之后的问卷星界面,选中需要复制的相关内容点击右键选择复制按钮。

5、在需要复制的文件上如WORD上点击右键选择粘贴按钮就可以看到已经将问卷星的问卷复制到了WORD文件里面了。

相关信息


电脑版

【免责声明】本站信息来自网友投稿及网络整理,内容仅供参考,如果有错误请反馈给我们及时更正,对文中内容的真实性和完整性本站不提供任何保证,不承但任何责任。
版权所有:学窍知识网 Copyright © 2011-2024 www.at317.com All Rights Reserved .