Tag: 内存中的

在内存中打开XMLstring作为Excel工作簿而不保存使用Windows Forms C#

我有一个excelstring(我build立)在内存中; 代码看起来像这样: public static void exportToExcel() { const string startExcelXML = "<xml version>\r\n<Workbook " + "xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"\r\n" + " xmlns:o=\"urn:schemas-microsoft-com:office:office\"\r\n " + "xmlns:x=\"urn:schemas- microsoft-com:office:" + "excel\"\r\n xmlns:ss=\"urn:schemas-microsoft-com:" + "office:spreadsheet\">\r\n <Styles>\r\n " + "<Style ss:ID=\"Default\" ss:Name=\"Normal\">\r\n " + "<Alignment ss:Vertical=\"Bottom\"/>\r\n <Borders/>" + "\r\n <Font/>\r\n <Interior/>\r\n <NumberFormat/>" + "\r\n <Protection/>\r\n </Style>\r\n " + "<Style ss:ID=\"BoldColumn\">\r\n <Font " + […]

在内存中使用Java创build一个Excel文件,并作为字节传递下载

我用jxl库创build了一个excel文件。 代码工作正常,但唯一的问题是,每次从服务的dynamic值构build一个Excel文件,Excel内容覆盖到一个test.xls如下所示。 有没有什么办法可以在内存中创build一个excel并传递字节来下载它,而不是创build一个外部文件(“ test.xls ”) File file = new File("test.xls"); WritableWorkbook workbook = Workbook.createWorkbook(file); : : : : InputStream in = new FileInputStream(file); if (in == null) { out.close(); } else { byte[] buffer = new byte[4096]; int len; while ((len = in.read(buffer)) != -1) { out.write(buffer, 0, len); } out.flush(); in.close(); out.close(); } 任何人都可以请帮助我