我可以使用apache poi创建一个excel文件.但是,我希望用户能够将其下载为"真正的"excel文件.我想要实现的效果是有一个允许用户下载文件的弹出框.这类似于使用
<%@ page contentType="application/vnd.ms-excel" pageEncoding="ISO-8859-1"%>
<%response.setHeader("Content-Disposition", "attachment;filename=myfile.xls"); %>
Run Code Online (Sandbox Code Playgroud)
有一个严重的例外:我必须允许用户下载一个合适的excel文件.我在某处读到上面的代码只是告诉客户端服务器正在发送一个excel文件
我读过一些关于ROWCOUNT的内容,但它并不是我想要的.从我的理解rowcount说明运行查询后受影响的行数.我正在寻找的是在运行查询之前知道.这可能吗?
我的目标是创建一个Excel文件供用户通过apache poi下载.
我在我的servlet中有这个代码:
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
// create a workbook , worksheet
Workbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("MySheet");
CreationHelper createHelper = wb.getCreationHelper();
// Create a row and put some cells in it. Rows are 0 based.
Row row = sheet.createRow((short)0);
Cell cell = row.createCell(0);
cell.setCellValue(1);
row.createCell(1).setCellValue(1.2);
row.createCell(2).setCellValue( createHelper.createRichTextString("This is a string") );
row.createCell(3).setCellValue(true);
//write workbook to outputstream
ServletOutputStream out = response.getOutputStream();
wb.write(out);
out.flush();
out.close();
//offer the user the option of …Run Code Online (Sandbox Code Playgroud) 我继承了一个ms sql server 2008服务器应用程序,并在检查存储过程时,我注意到它们以一个USE [ELECS]语句开头,ELECS是数据库名称.
当我尝试重新创建其中一个存储过程时,我得到的是一个错误,说存储过程不能有一个use语句.
消息154,级别15,状态1,过程TESTME,第3行,过程,函数或触发器中不允许使用USE数据库语句.
ms sql server有一个特殊的功能允许这个吗?
我似乎忘记了在win32机器上使用makefile作为ac程序时在命令行输入的内容.我记得的是我应该输入类似的东西
mingw32 -make
.但这不是atm.香港专业教育学院做了所有必要的事情,如设置环境mingw变量.对命令有什么帮助?
我看到这对如何通过Apache下议院做流媒体文件上传漂亮的指南.这让我想到数据存储在哪里?是否有必要"关闭"或"清理"该位置?
谢谢!
我有一个文件位于一个文件夹,其完整路径是这样的:
\ mymachine上\ mydrive $ \的Inetpub\wwwroot的\ MyFolder文件
是否可以通过asp serverVariables获得相同的值?我害怕在我的源代码中暴露上面的路径.谢谢!
操作系统:Windows 7
我的理解是\ r将文本移动到页面的左侧.
但是当我执行这个时:
carriage_return = "I will use a carriage\rreturn"
print carriage_return
Run Code Online (Sandbox Code Playgroud)
我得到了:回来使用马车
我期待的是:回归
美好的一天!假设我有一个像这样的格式的字符串^ abc ^我想只得到abc.除了下面的代码,你能教我一种更有效的剥离分隔符的方法吗?谢谢
### line = '^123.456.102345^'
start = line.find ('^')
line = line[(start+1):]
end = line.find ('^')
line = line[:end]
print line
Run Code Online (Sandbox Code Playgroud) 查看几个android示例,我看到一种趋势,其中使用join()方法暂停了线程:
编辑:请假定正确定义了2个线程。编辑了对join()的调用
public class MainUI extends Activity{
private GraphicsViewThread g;
private BackendDataViewThread b;
void onCreate(){
g = new GraphicsViewThread();
g.start();
b = new BackendDataViewThread();
b.start();
}
.
.
.
void pauseGame(){
try {
g.join();
}catch (InterruptedException e){
e.printStackTrace();
}
try {
b.join();
}catch (InterruptedException e){
e.printStackTrace();
}
GraphicsViewThread = null;
BackendDataViewThread = null;
}
}
Run Code Online (Sandbox Code Playgroud)
查看String的split方法的文档,我遇到了分隔符
//
这是一个白色空间分隔符吗?为什么返回的数组包含""值?
"now's the time".split(/ /) #=> ["", "now's", "", "the", "time"]
Run Code Online (Sandbox Code Playgroud) servlets ×3
apache-poi ×2
java ×2
jsp ×2
python ×2
sql-server ×2
android ×1
asp-classic ×1
c ×1
mingw32 ×1
python-2.7 ×1
ruby ×1
sql ×1
t-sql ×1