Problem in creating Excel file
Dear all,
i have occured aproblem while creating an Excel file while using JSP.
in my jsp file i have given the two codes of line:
<%
response.setContentType("application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment");
%>
which creates an Excel file..But in my JSP File, i have some code using java Script. now , after creating the Excel File sucessfully, the jsp page is open but the JavaScript is not working .
what might be the problem ..
like in "one.jsp" i have the code to call "two.jsp" in which the above code is written. so in my calling jsp page ie., "one.jsp" once i call the "two.jsp" the Excel file is created sucessfully, and the page "one.jsp" is displayed as it is, but the javaScript in it is not working again..
please do the need full.
Thanks in Advance.
Reagards
Chandu
Dear all,
i have occured aproblem while creating an Excel file while using JSP.
in my jsp file i have given the two codes of line:
<%
response.setContentType("application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment");
%>
which creates an Excel file..But in my JSP File, i have some code using java Script. now , after creating the Excel File sucessfully, the jsp page is open but the JavaScript is not working .
what might be the problem ..
like in "one.jsp" i have the code to call "two.jsp" in which the above code is written. so in my calling jsp page ie., "one.jsp" once i call the "two.jsp" the Excel file is created sucessfully, and the page "one.jsp" is displayed as it is, but the javaScript in it is not working again..
please do the need full.
Thanks in Advance.
Reagards
Chandu
Similar Messages
-
Hi,
I'm to create Excel file by C# codes and have got this
Error 1 Assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' uses 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' which has a higher version than referenced assembly 'office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
Error 2 Assembly 'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' uses 'Microsoft.Vbe.Interop, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' which has a higher version than referenced assembly 'Microsoft.Vbe.Interop, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
using these codes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.RegularExpressions;
using System.Globalization;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using Microsoft.Office.Interop;
using Excel = Microsoft.Office.Interop.Excel;
namespace ns1
class Program
static void Main(string[] args)
string orp_path = "//ABC";
bool allowappend = true;
string test = "test";
Excel.Application app = null;
Excel.Workbook workbook = null;
Excel.Worksheet worksheet = null;
Excel.Range workSheet_range = null;
object misValue = System.Reflection.Missing.Value;
Excel.Application xlApp = new
Microsoft.Office.Interop.Excel.Application();
workbook = xlApp.Workbooks.Add(misValue);
workbook = xlApp.Workbooks.Add(misValue);
worksheet = (Excel.Worksheet)workbook.Worksheets.get_Item(1);
worksheet.Cells[1, 1] = "Run Date";
workbook.SaveAs("c:\\" + test + ".xls", Excel.XlFileFormat.xlOpenXMLTemplate, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
workbook.Close(true, misValue, misValue);
xlApp.Quit();
releaseObject(worksheet);
releaseObject(workbook);
releaseObject(xlApp); ...
on VS 2013. Any advice?
Many Thanks & Best Regards, Hua MinHey,
Not sure what the problem is, I got the code working.
One thing you're doing wrong though: Excel.XlFileFormat.xlOpenXMLTemplate supposes you're using the file extension ".xlsx" (Open XML format) and not ".xls" (Microsoft Excel 97-2003).
So you should start by changing either the extension to xlsx or the XlFileFormat to
xlExcel8.
For further reference take a look
here -
Problem in Creating excel file from internal table
Hi Experts,
here iam having a proble with creating an excel file from an internal table which is having around 15 records, when iam generating an excel file, its getting only upto 255 chars, after that its breaking and new record is being started in the next row. how should i get all the contents in one row of the excel or may be extended to the next line , how to resolve this issue, can anyone give me some idea or sample code.
Thanks & Regards,
poornaur downloading to excel using a single field...then it will download only 255 chars....may be from internla table u can download the fields and the excel sheet gets downloaded with data....check below code....
*& Report ZETA_EXCEL_DOWNLOAD_CLIPBOARD *
report zeta_excel_download_clipboard .
include ole2incl.
data: w_cell1 type ole2_object,
w_cell2 type ole2_object.
*--- Ole data Declarations
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object, " font
gs_interior type ole2_object, " Pattern
worksheet type ole2_object,
h_cell type ole2_object,
h_cell1 type ole2_object,
range type ole2_object,
h_sheet2 type ole2_object,
h_sheet3 type ole2_object,
gs_font type ole2_object,
flg_stop(1) type c.
Internal table Declaration
data: begin of t_excel occurs 0,
vkorg(20) type c, "Sales Org
vbtyp(20) type c, "Document Category
auart(20) type c, "Document Type
ernam(20) type c, "Created By
vbeln(20) type c, "Document Number
posnr(20) type c, "Item Number
erdat(20) type c, "Created Date
vdatu(20) type c, "Header Requested Delivery Date
reqdat(20) type c, "Request date
condat(20) type c, "Confirm date
lifsk(20) type c, "Header Block
txt30(30) type c, "Order User Status Description
lifsp(20) type c, "Line Block
dispo(20) type c, "MRP Controller
dsnam(20) type c, "MRP Controller Description
vmsta(20) type c, "Material Sales Status
kunnr(20) type c, "Sold To
cname(35) type c, "Sold To Name
regio(20) type c, "State
cufd(10) type c, "CUD
bstnk(20) type c, "PO#
bsark(20) type c, "Ordering Method
matnr(20) type c, "Material
maktx(35) type c, "Material Description
t200(20) type c, "T200
vtext(20) type c, "T200 Description
matkl(20) type c, "Material Group
zzbomind(7) type c, "BOM Indicator
ostat(20) type c, "Order Status
cmgst(20) type c, "CRD
inco1(20) type c, "Incoterms
oqty(20) type c, "Order Quantity
pqty(20) type c, "Open Quantity
unit(20) type c, "UOM
onet(20) type c, "Order Value
pnet(20) type c, "Open Value
curr(20) type c, "Currency key
so_bezei like tvkbt-bezei,"Sales Office
sg_bezei like tvgrt-bezei,"Sales Group
bname(20) type c, "Ordering Party
contact(20) type c, "Contact Name
telf1(20) type c, "Contact telf1
reqqty(20) type c, "Item Request qty
reqval(20) type c, "Item Request value
conqty(20) type c, "Item Confirm qty
conval(20) type c, "Item Confirm value
zzrev(02) type c, "Revenue recognition acceptance
bezei(20) type c, "Revenue recognition text
vgbel(20) type c, "Reference Order for RETURNS
0008text(255) type c, "Internal Order Comment Text
end of t_excel.
data: t_excel_bckord like t_excel occurs 0 with header line,
t_excel_bcklog like t_excel occurs 0 with header line,
t_excel_blkord like t_excel occurs 0 with header line.
types: data1(1500) type c,
ty type table of data1.
data: it type ty with header line,
it_2 type ty with header line,
it_3 type ty with header line,
rec type sy-tfill,
deli(1) type c,
l_amt(18) type c.
data: begin of hex,
tab type x,
end of hex.
field-symbols: <fs> .
constants cns_09(2) type n value 09.
assign deli to <fs> type 'X'.
hex-tab = cns_09.
<fs> = hex-tab.
data gv_sheet_name(20) type c .
M A C R O Declaration
define ole_check_error.
if &1 ne 0.
message e001(zz) with &1.
exit.
endif.
end-of-definition.
t_excel_bckord-vkorg = 'ABC'.
t_excel_bckord-vbtyp = 'DEF'.
t_excel_bckord-auart = 'GHI'.
t_excel_bckord-ernam = 'JKL'.
t_excel_bckord-vbeln = 'MNO'.
t_excel_bckord-0008text = 'XYZ'.
append t_excel_bckord.
t_excel_bckord-vkorg = 'ABC1'.
t_excel_bckord-vbtyp = 'DEF1'.
t_excel_bckord-auart = 'GHI1'.
t_excel_bckord-ernam = 'JKL1'.
t_excel_bckord-vbeln = 'MNO1'.
t_excel_bckord-0008text = 'XYZ1'.
append t_excel_bckord.
t_excel_bckord-vkorg = 'ABC2'.
t_excel_bckord-vbtyp = 'DEF2'.
t_excel_bckord-auart = 'GHI2'.
t_excel_bckord-ernam = 'JKL2'.
t_excel_bckord-vbeln = 'MNO2'.
t_excel_bckord-0008text = 'XYZ2'.
append t_excel_bckord.
t_excel_bcklog-vkorg = 'ABC'.
t_excel_bcklog-vbtyp = 'DEF'.
t_excel_bcklog-auart = 'GHI'.
t_excel_bcklog-ernam = 'JKL'.
t_excel_bcklog-vbeln = 'MNO'.
t_excel_bcklog-0008text = 'XYZ'.
append t_excel_bcklog.
t_excel_bcklog-vkorg = 'ABC1'.
t_excel_bcklog-vbtyp = 'DEF1'.
t_excel_bcklog-auart = 'GHI1'.
t_excel_bcklog-ernam = 'JKL1'.
t_excel_bcklog-vbeln = 'MNO1'.
t_excel_bcklog-0008text = 'XYZ1'.
append t_excel_bcklog.
t_excel_bcklog-vkorg = 'ABC2'.
t_excel_bcklog-vbtyp = 'DEF2'.
t_excel_bcklog-auart = 'GHI2'.
t_excel_bcklog-ernam = 'JKL2'.
t_excel_bcklog-vbeln = 'MNO2'.
t_excel_bcklog-0008text = 'XYZ2'.
append t_excel_bcklog.
t_excel_bcklog-vkorg = 'ABC3'.
t_excel_bcklog-vbtyp = 'DEF3'..
t_excel_bcklog-auart = 'GHI3'.
t_excel_bcklog-ernam = 'JKL3'.
t_excel_bcklog-vbeln = 'MNO3'.
t_excel_bcklog-0008text = 'XYZ3'.
append t_excel_bcklog.
t_excel_blkord-vkorg = 'ABC'.
t_excel_blkord-vbtyp = 'DEF'.
t_excel_blkord-auart = 'GHI'.
t_excel_blkord-ernam = 'JKL'.
t_excel_blkord-vbeln = 'MNO'.
t_excel_blkord-0008text = 'XYZ'.
append t_excel_blkord.
t_excel_blkord-vkorg = 'ABC1'.
t_excel_blkord-vbtyp = 'DEF1'.
t_excel_blkord-auart = 'GHI1'.
t_excel_blkord-ernam = 'JKL1'.
t_excel_blkord-vbeln = 'MNO1'.
t_excel_blkord-0008text = 'XYZ1'.
append t_excel_blkord.
t_excel_blkord-vkorg = 'ABC2'.
t_excel_blkord-vbtyp = 'DEF2'.
t_excel_blkord-auart = 'GHI2'.
t_excel_blkord-ernam = 'JKL2'.
t_excel_blkord-vbeln = 'MNO2'.
t_excel_blkord-0008text = 'XYZ2'.
append t_excel_blkord.
t_excel_blkord-vkorg = 'ABC3'.
t_excel_blkord-vbtyp = 'DEF3'..
t_excel_blkord-auart = 'GHI3'.
t_excel_blkord-ernam = 'JKL3'.
t_excel_blkord-vbeln = 'MNO3'.
t_excel_blkord-0008text = 'XYZ3'.
append t_excel_blkord.
t_excel_blkord-vkorg = 'ABC4'.
t_excel_blkord-vbtyp = 'DEF4'..
t_excel_blkord-auart = 'GHI4'.
t_excel_blkord-ernam = 'JKL4'.
t_excel_blkord-vbeln = 'MNO4'.
t_excel_blkord-0008text = 'XYZ4'.
append t_excel_blkord.
loop at t_excel_bckord.
concatenate
t_excel_bckord-vkorg
t_excel_bckord-vbtyp
t_excel_bckord-auart
t_excel_bckord-ernam
t_excel_bckord-vbeln
t_excel_bckord-posnr
t_excel_bckord-erdat
t_excel_bckord-vdatu
t_excel_bckord-reqdat
t_excel_bckord-condat
t_excel_bckord-lifsk
t_excel_bckord-txt30
t_excel_bckord-lifsp
t_excel_bckord-dispo
t_excel_bckord-dsnam
t_excel_bckord-vmsta
t_excel_bckord-kunnr
t_excel_bckord-cname
t_excel_bckord-regio
t_excel_bckord-cufd
t_excel_bckord-bstnk
t_excel_bckord-bsark
t_excel_bckord-matnr
t_excel_bckord-maktx
t_excel_bckord-t200
t_excel_bckord-vtext
t_excel_bckord-matkl
t_excel_bckord-zzbomind
t_excel_bckord-ostat
t_excel_bckord-cmgst
t_excel_bckord-inco1
t_excel_bckord-oqty
t_excel_bckord-pqty
t_excel_bckord-unit
t_excel_bckord-onet
t_excel_bckord-pnet
t_excel_bckord-curr
t_excel_bckord-so_bezei
t_excel_bckord-sg_bezei
t_excel_bckord-bname
t_excel_bckord-contact
t_excel_bckord-telf1
t_excel_bckord-reqqty
t_excel_bckord-reqval
t_excel_bckord-conqty
t_excel_bckord-conval
t_excel_bckord-zzrev
t_excel_bckord-bezei
t_excel_bckord-vgbel
t_excel_bckord-0008text
into it
separated by deli.
append it.
clear it.
endloop.
loop at t_excel_bcklog.
concatenate
t_excel_bcklog-vkorg
t_excel_bcklog-vbtyp
t_excel_bcklog-auart
t_excel_bcklog-ernam
t_excel_bcklog-vbeln
t_excel_bcklog-posnr
t_excel_bcklog-erdat
t_excel_bcklog-vdatu
t_excel_bcklog-reqdat
t_excel_bcklog-condat
t_excel_bcklog-lifsk
t_excel_bcklog-txt30
t_excel_bcklog-lifsp
t_excel_bcklog-dispo
t_excel_bcklog-dsnam
t_excel_bcklog-vmsta
t_excel_bcklog-kunnr
t_excel_bcklog-cname
t_excel_bcklog-regio
t_excel_bcklog-cufd
t_excel_bcklog-bstnk
t_excel_bcklog-bsark
t_excel_bcklog-matnr
t_excel_bcklog-maktx
t_excel_bcklog-t200
t_excel_bcklog-vtext
t_excel_bcklog-matkl
t_excel_bcklog-zzbomind
t_excel_bcklog-ostat
t_excel_bcklog-cmgst
t_excel_bcklog-inco1
t_excel_bcklog-oqty
t_excel_bcklog-pqty
t_excel_bcklog-unit
t_excel_bcklog-onet
t_excel_bcklog-pnet
t_excel_bcklog-curr
t_excel_bcklog-so_bezei
t_excel_bcklog-sg_bezei
t_excel_bcklog-bname
t_excel_bcklog-contact
t_excel_bcklog-telf1
t_excel_bcklog-reqqty
t_excel_bcklog-reqval
t_excel_bcklog-conqty
t_excel_bcklog-conval
t_excel_bcklog-zzrev
t_excel_bcklog-bezei
t_excel_bcklog-vgbel
t_excel_bcklog-0008text
into it_2
separated by deli.
append it_2.
clear it_2.
endloop.
loop at t_excel_blkord.
concatenate
t_excel_blkord-vkorg
t_excel_blkord-vbtyp
t_excel_blkord-auart
t_excel_blkord-ernam
t_excel_blkord-vbeln
t_excel_blkord-posnr
t_excel_blkord-erdat
t_excel_blkord-vdatu
t_excel_blkord-reqdat
t_excel_blkord-condat
t_excel_blkord-lifsk
t_excel_blkord-txt30
t_excel_blkord-lifsp
t_excel_blkord-dispo
t_excel_blkord-dsnam
t_excel_blkord-vmsta
t_excel_blkord-kunnr
t_excel_blkord-cname
t_excel_blkord-regio
t_excel_blkord-cufd
t_excel_blkord-bstnk
t_excel_blkord-bsark
t_excel_blkord-matnr
t_excel_blkord-maktx
t_excel_blkord-t200
t_excel_blkord-vtext
t_excel_blkord-matkl
t_excel_blkord-zzbomind
t_excel_blkord-ostat
t_excel_blkord-cmgst
t_excel_blkord-inco1
t_excel_blkord-oqty
t_excel_blkord-pqty
t_excel_blkord-unit
t_excel_blkord-onet
t_excel_blkord-pnet
t_excel_blkord-curr
t_excel_blkord-so_bezei
t_excel_blkord-sg_bezei
t_excel_blkord-bname
t_excel_blkord-contact
t_excel_blkord-telf1
t_excel_blkord-reqqty
t_excel_blkord-reqval
t_excel_blkord-conqty
t_excel_blkord-conval
t_excel_blkord-zzrev
t_excel_blkord-bezei
t_excel_blkord-vgbel
t_excel_blkord-0008text
into it_3
separated by deli.
append it_3.
clear it_3.
endloop.
if h_excel-header = space or h_excel-handle = -1.
start Excel
create object h_excel 'EXCEL.APPLICATION'.
endif.
PERFORM err_hdl.
*--- get list of workbooks, initially empty
call method of h_excel 'Workbooks' = h_mapl.
PERFORM err_hdl.
set property of h_excel 'Visible' = 1.
add a new workbook
call method of h_mapl 'Add' = h_map.
PERFORM err_hdl.
*GV_SHEET_NAME = '1st SHEET'.
gv_sheet_name = 'Back Orders'.
get property of h_excel 'ACTIVESHEET' = worksheet.
set property of worksheet 'Name' = gv_sheet_name .
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
*CALL METHOD OF gs_cells 'Select' .
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
data l_rc type i.
call method cl_gui_frontend_services=>clipboard_export
importing
data = it[]
changing
rc = l_rc
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 1.
PERFORM err_hdl.
call method of h_excel 'Range' = range
exporting
#1 = w_cell1
#2 = w_cell2.
call method of range 'Select'.
PERFORM err_hdl.
call method of worksheet 'Paste'.
PERFORM err_hdl.
CALL METHOD OF h_excel 'QUIT'.
*GV_SHEET_NAME = '2ND SHEET'.
gv_sheet_name = 'Backlog'.
get property of h_excel 'Sheets' = h_sheet2 .
call method of h_sheet2 'Add' = h_map.
set property of h_map 'Name' = gv_sheet_name .
get property of h_excel 'ACTIVESHEET' = worksheet.
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
call method cl_gui_frontend_services=>clipboard_export
importing
data = it_2[]
changing
rc = l_rc
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 1.
PERFORM err_hdl.
call method of h_excel 'Range' = range
exporting
#1 = w_cell1
#2 = w_cell2.
call method of range 'Select'.
PERFORM err_hdl.
call method of worksheet 'Paste'.
*GV_SHEET_NAME = '3rd SHEET'.
gv_sheet_name = 'Blocked Orders'.
get property of h_excel 'Sheets' = h_sheet3 .
call method of h_sheet3 'Add' = h_map.
set property of h_map 'Name' = gv_sheet_name .
get property of h_excel 'ACTIVESHEET' = worksheet.
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
call method cl_gui_frontend_services=>clipboard_export
importing
data = it_3[]
changing
rc = l_rc
exceptions
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
others = 4.
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 1.
PERFORM err_hdl.
call method of h_excel 'Range' = range
exporting
#1 = w_cell1
#2 = w_cell2.
call method of range 'Select'.
PERFORM err_hdl.
call method of worksheet 'Paste'.
*--- disconnect from Excel
free object h_zl.
free object h_mapl.
free object h_map.
free object h_excel. -
Create Excel file in application server but the field value is incorrect
Hi Experts,
i am facing a problem when create excel file in application server using OPEN DATASET command.
the internal table have 4 field and one of those field contains 19 digit number --> ICCID.
the code running well, successfully create EXCELfile in application server but the problem is SAP only copy exactly first 15 digit numeric only and the rest became zero 0
Example :
the field value in internal table is 8962118800000447654 but when i opened in the excel file the value became 8962118800000440000.
and if i add alphabet like a8962118800000447654 then it is correct.
is there is anything wrong with my code?
here is my code
CONSTANTS: c_tab TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab. "Tab Char
Data : begin of lt_zdsdmmdt00005 occurs 0,
SERNR (18) type c,
MSISDNl(20) type c,
BOX1 (20) type c,
ICCID(30) type c,
end of lt_zdsdmmdt00005.
data : ld_temp(100) type c.
i_file = '/usr/sap/DM/test_excel.xls'.
open dataset i_file for output in legacy text mode.
loop at lt_zdsdmmdt00005.
move lt_zdsdmmdt00005-ICCID to ld_iccid .
concatenate lt_zdsdmmdt00005-sernr lt_zdsdmmdt00005-MSISDN lt_zdsdmmdt00005-BOX1 ld_iccid
into ld_temp separated by c_tab.
transfer ld_temp to i_file.
endloop.
close dataset i_file.
Best Regard,
Akbar.Hi Naveen,
thanks for your reply,
i already tried and the result still the same. any idea?
Best Regard,
Akbar. -
Problem making an Excel file from a jsp
Hi.
I'm developing a web application that uses Excel for printing the reports. So far everything has worked fine, at least for the created Excel files that do not have any images on them. Now I need to create an excel file with an image as the header. I tried adding the necessary code to include the image, but when I open it, the image is not displayed (like when you open an HTML page that could load a certain image). I tried using different ways to set the src to see if maybe the path was the problem, but everytime I got the same result...
How can I do this? How can I include the image and actually display it when the user opens the file in Excel?
Thanks in advance
CyberSpiderI had a similar porblem....
I got some help from...http://www.javaworld.com/javaworld/jw-10-2006/jw-1019-xmlexcel.html?page=1...
This is my code in servlet...
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet spreadSheet = wb.createSheet("Users");
spreadSheet.setColumnWidth((short) 0, (short) (256 * 25));
spreadSheet.setColumnWidth((short) 1, (short) (256 * 25));
// Creating Rows
HSSFRow row = spreadSheet.createRow(0);
HSSFCell cell = row.createCell((short) 1);
cell.setCellValue("Year 2005");
cell = row.createCell((short) 2);
cell.setCellValue("Year 2004");
HSSFRow row1 = spreadSheet.createRow(1);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cell = row1.createCell((short) 0);
cell.setCellValue("Revenue ($)");
cell = row1.createCell((short) 1);
cell.setCellValue("25656");
cell = row1.createCell((short) 2);
cell.setCellValue("15457");
FileOutputStream output = new FileOutputStream(new File("/tmp/Users.xls"));
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=Users.xls");
ServletOutputStream out = response.getOutputStream();
wb.write(output);
output.flush();
output.close();
forward = null;
In firefox i get the download dialog box but not able to open in from there,i need to save it and then open. In IE i dont get the dialog box instead the excell open inside the browser......Please help me to open a excel sheet onclick on a link "Export to excel" in jsp......
Thanks in advance... -
Problem while updating excel file in Km
Hai,
I am using jxl api to generate excel file . I need to update the excel file. for that i am creating tht excel file in temp location , and updating using this code.
excelFile=new File(fileName);
embedDataIntoExcel();
workbook.write();
workbook.close();
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
IUser ep5User =WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext context = new ResourceContext(ep5User);
RID rid = RID.getRID("/path/excelFile.xls");
IResourceFactory factory =ResourceFactory.getInstance();
IResource folder = (IResource) factory.getResource(rid,context);
FileInputStream fin = new FileInputStream(excelFile);
fin.read();
Content content = new Content(fin,"ms-excel", -1);
folder.updateContent(content);
<b>problem is the excel file is generating with some junk data </b>
how can i solve this
regards,
nagaHai,
I am using jxl api to generate excel file . I need to update the excel file. for that i am creating tht excel file in temp location , and updating using this code.
excelFile=new File(fileName);
embedDataIntoExcel();
workbook.write();
workbook.close();
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
IUser ep5User =WPUMFactory.getUserFactory().getEP5User(sapUser);
ResourceContext context = new ResourceContext(ep5User);
RID rid = RID.getRID("/path/excelFile.xls");
IResourceFactory factory =ResourceFactory.getInstance();
IResource folder = (IResource) factory.getResource(rid,context);
FileInputStream fin = new FileInputStream(excelFile);
fin.read();
Content content = new Content(fin,"ms-excel", -1);
folder.updateContent(content);
problem is the excel file is generating with some junk data
how can i solve this
regards,
naga -
ORA-06508 cannot create excel file
Hi,
I have forms 6i and windows 7. We have few forms which should create excel files but all of them fail with ORA-06508 and it happens only on my PC. Other colleagues don't have any problem with it. Forms path on my PC is the same as ones on other PC's.
Also weird, when I run problematic forms through debugger, they work correctly and create excel files.
How to solve this?
Tnx in advance,
NatiNati,
Recompiling libraries is not an option because of dependencies on too many forms. The number of Forms in your application and their dependencies is irrelevant if you follow one simple rule: Always compile PL/SQL Libraries first; compile Menu Modules second and lastly, compile your Forms. This will eliminate the dependency issues.
Anyway, mass recompiling is not allowed because of company rules. I disagree with this rule, but I don't work for your company! ;) Perhaps it is time for your company to re-evaluate this rule. :)
I tried with replacing ";" with ";" in particular form and the result was non-oracle exception 304500 which unfortunately doesn't say anything detailed. If this produced an error, I recommend you close all Forms related applications; re-open Forms builder and try again. This method should never produce an error.
I have forms 6i and windows 7.Forms 6i is not supported with Windows 7. More importantly, they are not compatible with each other. Forms 6i was designed to run on Windows 95/98. The differences between the Windows versions is tremendous. If you are unable to upgrade your Forms version, then at the very least, I recommend you run your application in Windows XP mode. This is not just setting the "Compatibility" to Windows XP. Take a look at Windows XP Mode - Windows 7 features, Install and Use Windows XP Mode in Windows 7 and Download Windows XP Mode.
Running Forms 6i on Windows 7 is like mixing Pickles with Ice Cream. Somethings are just not meant to go together. :)
Craig... -
How to Create Excel File in Background processing with different colors
HI All
I am trying to create Excel file in background & send it to user through e-mail, this i could acheive using fucntion module SO_DOCUMENT_SEND_API1, but here my requirement is i want to put different colors to columns of excel & this should happen in Background processing,
Initially i completed above requirement by using HTML type of document with attachment type 'ALI' & formatted output using write statement & used colors, after that i took this o/p using save_list function module & then table compress...etc.
but i don't know how to achieve same if we need o/p in excel as size of object of excel file is less than that of HTML
I am thankfull to everybody who will help me.
Regards
LokeshLokesh,
Iam also trying to populate my text file with colors as an attachment . If you know this please let me know. -
Problem in creating text file from report file
Hello Everybody...
I have problem in creating text file.
I had set System Parameter as below
DESTYPE : File
MODE : Character
DESNAME : gayu.txt
And ruler setting
Units : Character Cells
Character Cell Size : Horiziontal = 7
Vertiacle =12
GridSpacing : 1
no of snap points per grid spacing : 1
but when i run report it will give error
"REP_1219 M_2 or R_2 has no size -- length or width zero"
so is there any solution of that
or another way to convert report into text file?....Hi Folks,
Please don't go after that Error as its a very deceptive one. Please don't go for altering your design Or changing the size of items in your layout.
Similar errors I have come across in reports. I think its due to file transfer type. You might have transferred the file in Binary and your File Mode I am seeing it as CHAR.
This normally happens while making the Report Format as "Text". Either you change that format which I think is possible in your case as your basic requirement is making a report output of CHAR type.
Please check for this error in Metalink and proceed accordingly. I could fix similar errors when I changed Format type to PDF(from text).
Regards
Shibu -
What is the best approach/method to creating excel files on 9i using PL/SQL stored procedures/packages?
I have seen multiple posts on this topic but would like one source for this solution. I have also visited asktom and seen an example using owa_sylk. However, that one is specific to Oracle 8. Is there a newer and more efficient way to creating Excel files?
Regards...Is there a newer and more efficient way to creating Excel files?Nope.
And if you are required to use a stored procedure, then the best way is to write out a .csv file using UTL_FILE which is probably what you saw in the examples you mentioned. -
I have one problem in creating csv file.
If one column has single line value, it is coming in single cell. But if the column has no.of lines using carriage return while entering into the table,
I am not able to create csv file properly. That one column value takes more than one cell in csv.
For example the column "Issue" has following value:
"Dear
I hereby updated the Human Resources: New User Registration Form Request.
And sending the request for your action.
Regards
Karthik".
If i try to create the csv file that particular record is coming as follows:
0608001,AEGIS USERID,SINGAPORE,Dear
I hereby updated the Human Resources: New User Registration Form Request.
And sending the request for your action.
Regards
Karthik,closed.
If we try to load the data in table it is giving error since that one record is coming in more than one line. How can I store that value in a single line in csv file.
Pls help.I have tried using chr(10) and chr(13) like this......still it is not solved.
select REQNO ,
'"'||replace(SUBJECT,chr(13),' ')||'"' subject,
AREA ,
REQUESTOR ,
DEPT ,
COUNTRY ,
ASSIGN_TO ,
to_Date(START_DT) ,
START_TIME ,
PRIORITY ,
'"'||replace(issues, chr(13), ' ')||'"' issues,
'"'||replace(SOLUTIONS,chr(13),' ')||'"' SOLUTIONS ,
'"'||replace(REMARKS,chr(13),' ')||'"' REMARKS ,
to_date(CLOSED_DT) ,
CLOSED_TIME ,
MAN_DAYS ,
MAN_HRS ,
CLOSED_BY ,
STATUS from asg_log_mstr
Pls help. -
Automatically schedule FR or IR reports to create Excel files???
Hello,
My client asked me to 1) create reports against Essbase cubes, 2) automate the update of the reports to Excel files and 3) email the results to various people. In the first phase of this project I was able to do some of this as follows:
1) Created FR reports.
2) Scheduled the update of the FR reports to PDF files using the scheduler in Hyperion Workspace. NOTE: I created PDF files because that is the only thing that the scheduler can automatically produce from FR reports.
3) Created an Excel VBA application that emails the PDF files to a variable list of recipients (each report goes to a different list of people).
Now we are entering the second phase of this project and the client is asking to have the reports created in Excel files instead of PDF.
***** Questions *****
1) Can an IR report be scheduled using the Hyperion Scheduler in Hyperion Workspace to create Excel files?
2) Is there a utility (either Hyperion or other) that can convert PDF files to Excel files with the exact formatting of the original PDF?
Thank you,
Bill HThank you for your reply. After your reply I looked in the Hyperion Workspace User Guide and found how to schedule an IR report to create an Excel file. I think the next thing I am trying to determine is how to do "bursting" in IR. I currently have an FR report that gets data from Essbase. I have scheduled this in Workspace to run for all children of a member (or a different example would be all zero level decendants of a member). The Workspace scheduler allows me to create a file for each member and to add the member name to each filename so that they are different. Can I do the same type of thing with IR?
Thank you,
Bill H -
Dear All,
I have a problem with an EXCEL file, i'm in a domain with windows server 2003 and all of the computer have windows 7, a user had open 3 weeks ago a fil excel after she gone on holiday so the file remain open (i don't know how) by she.
I've try with all unlocker program to make the file deletable, but not work... it is very strange because if i try to open it with the account of the user that open the file appears always the same error (open read only)...
Could you help me?
thanksHi,
You may end the Excel process first, the “PsTools” have a pskill command that you can use to end a process remotely.
Here’s a simple command:
pskill \\computer –u username -p password excel.exe
For more information, please see the KB below:
http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
Best Regards -
Problem in creating excel J2EE module for file adapter
Hi All,
I have created an J2EE project for Excel File Reading and added all the required libraries , build an ear of it and also referenced libraries in j2ee.engine.xml of ear , deployed the ear in J2ee engine of XI . Now i am trying to use this module in communication sender channel like this
localejbs/ExcelFileAdapter
ExcelFileAdapter(JNDI Name)
I am using this module name before callsapadapter but nothing is happening , my excel file not getting picked up from the desired location. Can someone tell me where i did things wrong.
Thanx in Advance,
TraxThats part of my bean class code:
public ModuleData process(
ModuleContext mc,
ModuleData imd)
throws ModuleException {
Object obj = null;
Message msg = null;
String msgType = null;
String nameSpace = null;
try {
obj = imd.getPrincipalData();
msg = (Message) obj;
msgType = (String) mc.getContextData("msgType");
nameSpace = (String) mc.getContextData("nameSpace");
if (msg.getMessageDirection()== MessageDirection.INBOUND)
amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
else
amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.OUTBOUND);
XMLPayload xp = msg.getDocument();
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"AO: Now got the xml payload object.");
I think their is a some problem before 1st audit message is logged. -
Problem writing to excel file using report generation toolkit
hello everyone, i have this report generation toolkit... and i want to output DAQmx Analog I/P data on to an excel sheet. the DAQmx is programmed to collect
data at 3samples/sec. however, when i see the excel file that Report Generation Toolkit generates, the time stamp is updated every second instead of every 0.33sec.
can anyone please help me? i am using the MS Office Report Express VI.
Now on LabVIEW 10.0 on Win7@All, I got rid of the express VI, decided to work on the custom low level VIs instead. however, i have a new problem now...
I have a case statement wherein, the user selects if he wants to start generating a report. once the program enters tat loop, the program speed reduces!
can anyone please tell me why is it happening? i ahve attached the vi... also another question.. in this VI, i am capturing the unwanted data into the graph as I am indexin the graph input. how can i make a logic
that the graph captures the data only when I am switching the CREATE REPORT button (which is in the while loop). is there a way that I can append the data to the graph without creating a new graph every iteration? please let me know
thanks
Now on LabVIEW 10.0 on Win7
Attachments:
Untitled 7.vi 75 KB
Untitled 7.JPG 99 KB
Maybe you are looking for
-
Inserting a Re: in foreign mail - or where can i post a plug in request?
hello, i often email people in Europe - and so my copy of mail puts re: in front of their email, while theirs puts aw: or sv: or something else which means re in front of mine. i'd like to find out if it's possible to add to the list of exceptions wh
-
PDF (Designer7) forms not shown in Acrobat 6 or 5
I have created a simple PDF form with Designer 7, look at: http://www2.fht-esslingen.de/info/11.pdf This form can only be shown on Windows PC with Acrobat 7 Prof. not in Adobe Reader 7 or Acrobat 6 or 5. Can anybody explain me who to create a form wi
-
How to install optional plug-ins
I just read in the March issue of Photoshop User magazine about optional plug-ins you can download from http://www.adobe.com/support/downloads/detail.jsp?ftpID=4048. It includes the Contact Sheet II plug-in among others. The article described how to
-
Tiff saved in PS CC Hangs Lightroom, Photoshop and OS
This has happened twice in the past week. 1. Send a CR2 from LR to PS 2. Edit in PS 3. Save and return to LR. 4. Everything appears fine 5. Hours later, Tiff file cannot be read in LR. Loading Icon appears and never disappears. Lightroom eventually
-
Send PDF output directly to a printer
Hi, I want to send a PDF Oracle Reports directly to a printer. I found a plugin (pdfprint) on http://www.oracle.com/technology/products/reports/pluginxchange/index.html but it doesn't work. REP-50159: Executed successfully but there were some errors