XLSX

Adding image to Excel file generated by Axlsx.?

自作多情 提交于 2019-12-02 14:01:51
问题 I am using Axlsx for generating Excel file. I need to add image to the Excel File. I have used this code : ws.add_image(:image_src => '../something',:noSelect => true, :noMove => true) do |image| image.width=1000 image.height=200 image.start_at 0,0 end where ' ws ' is the worksheet. It adds the required image, but i am not able to set the ' width ' & ' height ' of the image with this code. Even if i give width=2000 and height=1000 , it does not affect the image in Excel file. Can anybody tell

Getting extension check(hardening) alert while opening a .xls file using Office 2007/2010

不羁岁月 提交于 2019-12-02 11:52:00
I am working on a struts based web application. In that application, we generate and download xls file from Jsp. In Jsp file and web.xml, I have set the content-type as "application/vnd.ms-excel" it seems xls files generated by the jsp pages are not real excel files, but a text format that is understood by the MS Excel. Hence excel opens the files and displays the output similar to excel files saved by MS Excel. Since newer versions of MS Office 2007/2010 checks the file extension and the content inside the file, they issue a warning that the file format does not match with the content. To get

Add a password (unattended) to existing xlsx without Windows exclusive tools

早过忘川 提交于 2019-12-02 06:59:47
I'm generating an xlsx file using Openpyxl. And i'd like to protect the workbook itself using a password that I have as a variable in the same script. This can be set manually using File > Passwords.. and setting "Password to open" in Excel itself. Openpyxl only seems to offer sheet based edit protection through ws.protection.set_password("mypassword") (where ws is an open worksheet) I can't seem to find the exact examples but somewhere I read that xlsx files were basically zip archives, and while it seemed true when I ran commands like unzip -t and 7z x it seems that adding a password using

Error Message after creating XLSX file using java

拈花ヽ惹草 提交于 2019-12-02 06:57:05
I am using apache poi to create a simple xlsx file using java as follows String date = "2014/12/29"; XSSFWorkbook w = ADPFidessa.createExcelWorkbook(date); response.reset(); response.setContentType("application/xlsx"); response.setHeader("Content-Disposition", "attachment;filename=ADP_Fidessa.xlsx"); w.write(response.getOutputStream()); and here is the createExcelWorkbook method public static XSSFWorkbook createExcelWorkbook(String sBsnsDt) throws Exception { // create a new file FileOutputStream out = new FileOutputStream("workbook.xlsx"); // create a new workbook XSSFWorkbook wb = new

Adding image to Excel file generated by Axlsx.?

送分小仙女□ 提交于 2019-12-02 06:11:56
I am using Axlsx for generating Excel file. I need to add image to the Excel File. I have used this code : ws.add_image(:image_src => '../something',:noSelect => true, :noMove => true) do |image| image.width=1000 image.height=200 image.start_at 0,0 end where ' ws ' is the worksheet. It adds the required image, but i am not able to set the ' width ' & ' height ' of the image with this code. Even if i give width=2000 and height=1000 , it does not affect the image in Excel file. Can anybody tell , what i doing wrong.? This looks correct to me as well, and is inline with the example in the gem. wb

POI Excel: get style name

落花浮王杯 提交于 2019-12-02 00:52:09
问题 I want to read the name given to a style applied to a cell in a xlsx document. I have extracted the file and in the xl/styles.xml i can find the style name: <cellStyles count="3"> <cellStyle xfId="2" builtinId="7" name="Currency [0]"/> <cellStyle xfId="0" builtinId="0" name="Normal"/> <cellStyle xfId="1" name="test style"/> </cellStyles> The style name i want is "test style". Currently i have the following code, and i can get the xfId but not the name: @Override public String getName(Workbook

Set Rows to repeat at top when printing - Open XML and Excel

大兔子大兔子 提交于 2019-12-01 20:56:13
I am trying to get the first 4 rows of an xlsx file to repeat at the top of each page when printed. I am using the Open XML SDK to accomplish this. My file is being generated by the SSRS execution web service as a filestream. I then need to modify several layout and page settings (margins, page size, zoom, etc) before delivering the file to the user, as my users have very little Excel acumen. All other settings I need to tweak are working correctly, so I have stripped out all of that code from this example. When trying to set the repeating page headers using the code below, it executes with no

Loading Excel file chunk by chunk with Python instead of loading full file into memory

假如想象 提交于 2019-12-01 20:41:01
I want to read just 10 lines from Excel files (xlsx) without loading the whole file at once, as it can't be done on one of my machines (low memory). I tried using import xlrd import pandas as pd def open_file(path): xl = pd.ExcelFile(path) reader = xl.parse(chunksize=1000) for chunk in reader: print(chunk) It seems like the file is loaded first then divided into parts. How to read only first lines? Due to the nature of xlsx files (which are essentially a bunch of xml files zipped together) you can't poke the file at an arbitrary byte and hope for it to be the beginning of Nth row of the table

PHP xlsx header

廉价感情. 提交于 2019-12-01 16:45:20
so this works: myphpfile.php: <?php header('Content-disposition: attachment; filename=myfile.pdf'); header('Content-type: application/pdf'); readfile('myfile.pdf'); ?> that php file is called here and the PDF download works fine: <a class = "oglasavanje" href = "../../cjenik/myphpfile.php">download</a><br/> but this doesn't work: <?php header('Content-disposition: attachment; filename=myfile.xlsx'); header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); readfile('myfile.xlsx'); ?> both .pdf and .xlsx files are in the same folder. When I click on the

openpyxl cell style not reporting correctly

时光毁灭记忆、已成空白 提交于 2019-12-01 16:20:14
Using the python library openpyxl I am reading an XLSX file created in excel 2007. it is empty apart from cell A1 which is coloured yellow and has the value "test" written in it. I can easily retrieve the value from that cell, however when I attempt to determine the fill colour I get the following results: this_sheet.cell("A1").style.fill.start_color returns "FFFFFF" this_sheet.cell("A1").style.fill.end_color returns "FF0000" Testing this on other blank cells I get exactly the same results, and trying to retrieve the font style information keeps returning calibri size 11 (our system default).