Write Table to Excel
I have taken the write table to xl.vi example and modified it so that I can use it. Write now I have a vi setup that displays certain columns of data that I am pulling from a txt file in both a graph and a table. Then I am trying to write this table to xl by following the example, however I get the error 97 when running the vi, and a blank excel workbook opens up. I think this has something to do with how the table I have created is used to try and enter this into excel. Any help you can provide would be greatly appreciated. Thanks.
Attachments:
Data_Display_2.vi 134 KB
Error 97 is "LabVIEW: Null Refnum was passed in as input."
You might wanna check whether the Automation Refnum is linked to the correct ActiveX class in the "Open Excel" VI.
In your diagram, as Dennis pointed out, it has no dataflow. The row header and column header in your table are both empty as well. That results in three for-loops doing nothing. Wire your "Hour" variable directly to the input of the third loop instead. Also at the end of the program, you should close all opened references regardless of the "Completion Task". Put only the invoke node "application quit" in the case structure should do.
Hope this helps.
Dan
Similar Messages
-
Write table to excel at specific location
Hi!
I want to write table to the excel file in the position
E23:To J60.
Can anybody please tell me the solution.
Thanks
KaustubhThe examples function just fine in LV 7
Here are som vi's that may (or may not) help you out.
Joe.
"NOTHING IS EVER EASY"
Attachments:
excel.llb 2097 KB -
Problem with write a table to excel
I want to open an existing Excel-file from Labview with ActiveX.
I have used the Example "write table XL.vi"
I changed the code that I can open the existing file but I am unable to
select a different sheet in Excel.There is always the first sheet active
and I cannot change this.
Can anybody help me?
robert
Sent via Deja.com http://www.deja.com/
Before you buy.wrote in message
news:8q4e0a$hsa$[email protected]..
> I want to open an existing Excel-file from Labview with ActiveX.
> I have used the Example "write table XL.vi"
> I changed the code that I can open the existing file but I am unable to
> select a different sheet in Excel.There is always the first sheet active
> and I cannot change this.
> Can anybody help me?
The workbook object has a "Sheets" property that returns a collection of all
the sheets in the active workbook. Use the "Item" method on this collection
to select the sheet you want- if necessary by cycling through all the
elements (use the "Count" property to find how many objects there are) and
using the "Name" property to get the name of the worksheet for comparison
with the one
you're looking for. Remember that everything is case sensitive. -
How to export data from a Dynpro table to Excel file?
Hi
Here I go again. I read the post <b>Looking for example to export data from a DynPro table to Excel file</b> and put the code lines into a Web Dynpro Project where we need to export a dynpro table to Excel file but exactly at line 23 it doesn't recognize <b>workBook = new HSSFWorkbook();</b>
1 //Declare this in the end between the Begin others block.
2
3 private FileOutputStream out = null;
4 private HSSFWorkbook workBook = null;
5 private HSSFSheet hsSheet = null;
6 private HSSFRow row = null;
7 private HSSFCell cell = null;
8 private HSSFCellStyle cs = null;
9 private HSSFCellStyle cs1 = null;
10 private HSSFCellStyle cs2 = null;
11 private HSSFDataFormat dataFormat = null;
12 private HSSFFont f = null;
13 private HSSFFont f1 = null;
14
15 //Code to create the Excel.
16
17 public void onActionExportToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
18 {
19 //@@begin onActionExportToExcel(ServerEvent)
20 try
21 {
22 out = new FileOutputStream("C:/mydirectory/myfiles/testexcel.xls");
23 workBook = new HSSFWorkbook();
24 hsSheet = workBook.createSheet("My Sheet");
25 cs = workBook.createCellStyle();
26 cs1 = workBook.createCellStyle();
27 cs2 = workBook.createCellStyle();
28 dataFormat = workBook.createDataFormat();
29 f = workBook.createFont();
30 f1 = workBook.createFont();
31 f.setFontHeightInPoints((short) 12);
32 // make it blue
33 f.setColor( (short)HSSFFont.COLOR_NORMAL );
34 // make it bold
35 // arial is the default font
36 f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
37
38 // set font 2 to 10 point type
39 f1.setFontHeightInPoints((short) 10);
40 // make it red
41 f1.setColor( (short)HSSFFont.COLOR_RED );
42 // make it bold
43 f1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
44 f1.setStrikeout(true);
45 cs.setFont(f);
46 cs.setDataFormat(dataFormat.getFormat("#,##0.0"));
47
48 // set a thick border
49 cs2.setBorderBottom(cs2.BORDER_THICK);
50
51 // fill w fg fill color
52 cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
53 cs2.setFillBackgroundColor((short)HSSFCellStyle.SOLID_FOREGROUND);
54 // set the cell format to text see HSSFDataFormat for a full list
55 cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
56 cs2.setFont(f1);
57 cs2.setLocked(true);
58 cs2.setWrapText(true);
59 row = hsSheet.createRow(0);
60 hsSheet.createFreezePane(0,1,1,1);
61 for(int i=1; i<10;i++)
62 {
63 cell = row.createCell((short)i);
64 cell.setCellValue("Excel Column "+i);
65 cell.setCellStyle(cs2);
66 }
67 workBook.write(out);
68 out.close();
69
70 //Read the file that was created.
71
72 FileInputStream fin = new FileInputStream("C:/mydirectory/myfiles/testexcel.xls");
73 byte b[] = new byte[fin.available()];
74 fin.read(b,0,b.length);
75 fin.close();
76
77 wdContext.currentContextElement().setDataContent(b);
78 }
79 catch(Exception e)
80 {
81 wdComponentAPI.getComponent().getMessageManager().reportException("Exception while reading file "+e,true);
82 }
83 //@@end
84 }
I don't know why this happen? Any information I will appreciate it.
Thanks in advance!!!
Tokio Franco ChangAfter test the code lines appears this error stacktrace:
[code]
java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
at com.sap.tc.webdynpro.progmodel.api.iwdcustomevent.ExportToExcel.onActionAct1(ExportToExcel.java:232)
at com.sap.tc.webdynpro.progmodel.api.iwdcustomevent.wdp.InternalExportToExcel.wdInvokeEventHandler(InternalExportToExcel.java:147)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:252)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:392)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
Thanks in advance!!!
Tokio Franco Chang
[/code] -
Problem While exporting HTML table to Excel(.CSV) in SharePoint 2010
Hi ,
I was exporting HTML table to .CSV file.
Problem is if any field contains '>' or '<' symbol then after exporting to .CSV, it was showing like '>' and '<' and the code is as below.
//Export HTML table to CSV
function toCSV() {
var data = document.getElementById('reportstable');
var csvData = [];
var tmpArr = [];
var tmpStr = '';
for (var i = 0; i < data.rows[0].cells.length; i++)
tmpArr.push((data.rows[0].cells[i].innerText || data.rows[0].cells[i].textContent));
csvData.push(tmpArr.join('\t'));
for (var i = 1; i < data.rows.length; i++)
tmpArr = [];
for (var j = 0; j < data.rows[0].cells.length; j++)
tmpArr.push(data.rows[i].cells[j].innerHTML);
csvData.push(tmpArr.join('\t'));
var output = csvData.join('\n');
SaveContents(output);
//For saving the file
function SaveContents(element) {
if (document.execCommand) {
var oWin = window.open("about:blank","_blank");
oWin.document.write(element);
oWin.document.close();
var success = oWin.document.execCommand('SaveAs', false, "FilteredReport.xls")
oWin.close();
Thanks in AdvanceHi,
According to your post, a problem occurred when you exported the HTML table to Excel(.CSV).
The following code for your reference:
function toCSV() {
var data = document.getElementById('reportstable');
var csvData = [];
var tmpArr = [];
var tmpStr = '';
for (var i = 0; i < data.rows[0].cells.length; i++)
tmpArr.push((data.rows[0].cells[i].innerText || data.rows[0].cells[i].textContent));
csvData.push(tmpArr.join('\t'));
for (var i = 1; i < data.rows.length; i++)
tmpArr = [];
for (var j = 0; j < data.rows[0].cells.length; j++)
tmpArr.push(data.rows[i].cells[j].innerHTML);
csvData.push(tmpArr.join('\t'));
var output = csvData.join('\n');
SaveContents(output.replace(/</g, '<').replace(/>/g, '>'));
Best Regards
Dennis Guo
TechNet Community Support -
Downloding from internal table to excel
Hi All,
I am using ole concept to download data from internal table to excel because i want to fill few records with colors and few with bold etc.
But this ole concept is downloading to excel line by line and taking much time.
How can i improve the performance in this concept or is there any other concept please let me know.
i am using fallowng logic to download to excel.
*Generating the Excel report in the foreground
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
start Excel
create object h_excel 'EXCEL.APPLICATION'.
set property of h_excel 'Visible' = 1.
get list of workbooks, initially empty
call method of h_excel 'Workbooks' = h_mapl.
perform err_hdl.
add a new workbook
call method of h_mapl 'Add' = h_map.
perform err_hdl.
output column headings to active Excel sheet
perform fill_cell using 1 1 1 000 'Job Name'(001).
perform fill_cell using 1 2 1 000 'Variant'(002).
perform fill_cell using 1 3 1 000 'Description'(003).
perform fill_cell using 1 4 1 000 'Run Date'(004).
perform fill_cell using 1 5 1 000 'Run Time'(005).
perform fill_cell using 1 6 1 000 'Duration'(006).
perform fill_cell using 1 7 1 000 'Spool'(007).
perform fill_cell using 1 8 1 000 'Records Upl'(008).
perform fill_cell using 1 9 1 000 'Error'(009).
perform fill_cell using 1 10 1 000 'Total'(010).
perform fill_cell using 1 11 1 000 'Action'(011).
perform fill_cell using 1 12 1 000 'ReRun'(012).
loop at t_final.
copy datato active EXCEL sheet
h = sy-tabix + 1.
perform fill_cell using h 1 0 000 t_final-jobname.
perform fill_cell using h 2 0 000 t_final-variant.
perform fill_cell using h 3 0 000 t_final-description.
perform fill_cell using h 4 0 000 t_final-strtdate.
perform fill_cell using h 5 0 000 t_final-strttime.
perform fill_cell using h 6 0 000 t_final-duration.
perform fill_cell using h 7 0 000 t_final-listident.
perform fill_cell using h 8 0 000 t_final-rec_upl.
perform fill_cell using h 9 0 000 t_final-rec_err.
perform fill_cell using h 10 0 000 t_final-rec_tot.
if t_final-comment eq 'job did not run'.
perform fill_cell using h 11 0 200 t_final-comment.
elseif t_final-rec_err eq 0.
perform fill_cell using h 11 0 000 t_final-comment.
else.
perform fill_cell using h 11 0 200 t_final-comment.
endif.
perform fill_cell using h 12 0 000 t_final-rerun.
endloop.
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
call method of h_excel 'Worksheets' = h_mapl." EXPORTIN G #1 = 2.
perform err_hdl.
add a new workbook
call method of h_mapl 'Add' = h_map exporting #1 = 2.
perform err_hdl.
tell user what is going on
set property of h_map 'NAME' = 'COPY'.
loop at t_final.
copy flights to active EXCEL sheet
h = sy-tabix + 1.
perform fill_cell using h 1 0 000 t_final-jobname.
perform fill_cell using h 2 0 000 t_final-variant.
perform fill_cell using h 3 0 000 t_final-description.
perform fill_cell using h 4 0 000 t_final-strtdate.
perform fill_cell using h 5 0 000 t_final-strttime.
perform fill_cell using h 6 0 000 t_final-duration.
perform fill_cell using h 7 0 000 t_final-listident.
perform fill_cell using h 8 0 000 t_final-rec_upl.
perform fill_cell using h 9 0 000 t_final-rec_err.
perform fill_cell using h 10 0 000 t_final-rec_tot.
if t_final-comment eq 'job did not run'.
perform fill_cell using h 11 0 200 t_final-comment.
elseif t_final-rec_err eq 0.
perform fill_cell using h 11 0 000 t_final-comment.
else.
perform fill_cell using h 11 0 200 t_final-comment.
endif.
perform fill_cell using h 12 0 000 t_final-rerun.
endloop.
free object h_excel.
perform err_hdl.
*& Form ERR_HDL
outputs OLE error if any *
form err_hdl.
if sy-subrc <> 0.
write: / 'Batch Job Automation Carried Out Succesfully'.
stop.
endif.
endform. " ERR_HDL .
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
form fill_cell using i j bold col val.
call method of h_excel 'Cells' = h_zl exporting #1 = i #2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
set property of h_f 'Color' = col.
perform err_hdl.
endform. "FILL_CELLHi,
You are populating the Cells one by one from the internal table, and all of them are coloured and font is bold. the method is OK, but when the amount of data is huge - it is going to take a longer time. May be the performance will improve a little if you turn the visibility off.
I ll suggest you to use ALV_XXL_CALL, it can color the key columns, at the same time you can have colored headings - and the performance is good. It is the same function module called when you do a "Export to Excel" from an ALV grid. But you can compain about the Font characteristics - as this does not change the Font size etc.
Your code has got a lot of freedom as long as the formatting is concerned - for bigger data - i ll suggest you to use a WS_DOWNLOAD kind of a function module to get the data at once in the presentation server and then call Excel methods and do the formatting. -
I want to write data from oracle table to Excel sheet in formated way like bold or merge the cell in case of same value.
Edited by: shiv kumar on Jul 27, 2010 10:18 AMRead Suns JDBC Tutorial, then if there is already an Excel spreadsheet set up to use as an ODBC datasource use JDBC and the JDBC/ODBC bridge. If there is not an already setup ODBC Datasource then Google POI HSSF and/or JExcel to do the Excel part.
-
Hi everyone, i'm trying to export a table to excel and I'm having some trouble.
First, I used "Write To Spreadsheet File.vi" to create a .xls file, and that worked perfectly, but now I need to export another table to a different sheet of the same xls file (whose name we should be able to choose), so I've begun to use the ActiveX controls.
I can create the new sheet with the name desired, and write the data into it, but the problem is that it doesn't show only my table, but also ALL of the cells (65536 x VI) with the value #N/A.
I can solve the problem in one of the dimensions, but not in both of them. It's the first time I use the ActiveX functions (I've built this VI with the help of other examples I've found in the forum), so I think I'm missing something important.
What can I do to show ONLY my table?
Thanks a lot for your time and knowledge.
Solved!
Go to Solution.
Attachments:
Tablexcel.7z 91 KBThank you very much ben64, now I understand better how the ActiveX works (specially the "Cell1" and "Cell2" properties of "Range"), and the program does exactly what I wanted it to do.
Now I added a few things just to close and save without showing the Excel window (the "workbook close" and "application quit" nodes, and the FALSE value to the "visible" entry of the "OPEN EXCEL" block ), but what I get by doing what you can see in the attached picture is Excel fastly opening and closing in less than a second... Any idea of how to do it without seeing the Excel window?
Thanks again
Arubio10
Attachments:
TablexcelDef.PNG 36 KB -
Error -2147417851 for example write table to XL
Hi, I want to save array data into excel. I try the example write table to XL.vi
but error -2147417851 comes out
I have no idea to solve this error.
Can anybody help?
Thank you very much!
Solved!
Go to Solution.Oh, here is the example
Attachments:
Write Table To XL.vi 88 KB -
Hello Experts,
I have created a table in UI5 based on Odata Model.
Now I want to download this table to Excel.
I checked that this is possible through creating a xsjs file as mentioned here:
Export to Excel in XS Project
As seen in the thread, they have written query
var query = 'SELECT TOP 25000 "PurchaseOrderId", "PartnerId","CompanyName", "CreatedByLoginName","History.CREATEDAT", "GrossAmount" '
+ 'FROM "sap.hana.democontent.epm.data::purchaseOrderHeaderExternal" order by "PurchaseOrderId"';
Now my problem is that I am using input parameters in my UI to load table.
So I want to know how to pass the input parameters to my xsjs file.
And also is there any other way that I can use to export odata table directly to Excel?
Regards,
RohitHi Jacob,
If you're on Java stack (which you are if you're using Apache POI anyway ), the most simple way is :
1) Create a REST service which generates the Excel workbook:
@GET
@Path("/getexcelfile")
public void getExcelFile(@Context HttpServletRequest request, @Context HttpServletResponse response) throws InternalServerErrorException {
try {
OutputStream out = null;
try {
List yourData = <get your list of data>
String filename = "myexcel.xls";
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
WritableWorkbook writableWorkbook = Workbook.createWorkbook(response.getOutputStream());
WritableSheet writableSheet = writableWorkbook.createSheet("My Excel Worksheet", 0);
createExcelHeaderRow(writableSheet);
createExcelSheetContent(yourData, writableSheet);
writableWorkbook.write();
writableWorkbook.close();
} catch (Exception exception) {
} finally {
if (out != null) out.close();
} catch (Exception exception) {
2) in your UI5 app, simply use a link to download your Excel file:
var oDownloadExcelButton = new sap.ui.commons.Link( {
text : "Download Excel File",
href : "/<your_EAR_context>/<your_REST_context>/getexcelfile" -
Error when run "write table to xl.vi"
When I run the labview sample "write table to xl.vi", an error, "Old format or invalid type library.
in Open New WorkBook.vi->Write Table to XL.vi", appeared in the invoke node of workbooks.
I use Labview 6i and office xp in Windows XP. What drive softwares should I install for solving the problem? Thanks!Here try this.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
Attachments:
XL.llb 150 KB -
How to export a table in excel (in JSP)???
hi all,
I am using AJAX functionality in jsp to export a table into Excel.But i don't want to use it as it gives a hyperlink whereas i want a button which should work similar to hypelink.
I mean to say i want a saperate export button which should work similar to the hyperlink.
if anybody has any idea abt it....plz reply it soon.......So what you want to do is redirect to a page when the user clicks the button?
So just put the button in a form with the action attribute set to wherever the hyperlink points now.
And in case the button is already a part of a form, then on the onClick() event of the button, change the action attribute of the form to this particular hyperlink target and then cause it to submit.
That ok?
Or do you want the Excel file you're generating to be sent to the browser causing it to popup a dialog asking the user to save or open? If so take a look here http://forum.java.sun.com/thread.jspa?threadID=5170452&messageID=9655276 -
How can I use PowerPivot tables like Excel tables -- printing, etc.?
I can't seem to find any information on this anywhere, and even more surprisingly, no one else seems to have even asked this question...
How can I use tables I create in the Excel PowerPivot window in the same ways I use tables that are in ordinary Excel worksheets, to accomplish tasks such as printing? I am able to use the powerful capabilities of PowerPivot to produce tables with precisely
the information I need for reports -- connecting data from multiple tables/sources, filtering, etc. -- but then there doesn't seem to be any way to actually print what I'm seeing, nor can I seem to access cells in these PowerPivot tables from Excel worksheets.
If a PowerPivot table is conceptually an Excel table with additional power in terms of pulling in data and relating it, it would seem appropriate that all the power of Excel could be brought to bear on these PowerPivot tables, but on the contrary, the available
operations are limited. if, instead, a PowerPivot table is more correctly viewed as a data source that Excel worksheets can connect to, that would be fine, and indeed, one
can use a PowerPivot table as a data source -- except it can't be brought into an Excel worksheet as an ordinary Excel table, unlike most other data sources.
I hope I'm missing something really obvious, and that someone can point out what it is. Thanks.Kirchh,
When PowerPivot was first designed, the decision was to integrate closely to Sharepoint to allow for team sharing. We are constantly evaluating customer feedback to add more features, and this has been one of the feedbacks we have received. We will consider
supporting this in the future but with no gurantee.
Chu
-- This posting is provided "AS IS" with no warranties, and confers no rights
I'm not questioning why PowerPivot is closely integrated with SharePoint. I'm asking why connecting to the PowerPivot model from within Excel was intentionally blocked by Microsoft, when all the functionality to do so appears to be present.
Is creating an OLE DB connection in Excel to PowerPivot as $Embedded$ supported?
No support. It was originally designed for SharePoint. This changed with Power Pivot for Excel 2013 (it's packaged with it). Originally the scope (in 2010 through 2012) was that it was for SharePoint users. So it became more obvious through that to market it
toward all Excel users. Thus the recent changes.
Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it! -
How to export the data from table to excel sheet
hi experts i have some problem am trying to export the data fro table to Excel sheet in the view controller i have created one button wit public void onActionCLEAR(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionCLEAR(ServerEvent)
//wdContext.nodeBapi_Salesorder_Getlist_Input().
//wdContext.nodeBapi_Salesorder_Getlist_Input().invalidate();
//@@end
//@@begin javadoc:onActionExporToExcel(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionExporToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionExporToExcel(ServerEvent)
try{
FileOutputStream fos=new FileOutputStream("Test.xls");
PrintStream ps=new PrintStream(fos);
ps.println("<html><body><table border=1>");
int size=wdContext.nodeBapi_Salesorder_Getlist_Input().size();
Iterator attributes=wdContext.getNodeInfo().iterateAttributes();
ps.println("<tr>");
while(attributes.hasNext()){
ps.println("<th>");
DataAttributeInfo attrName=(DataAttributeInfo)attributes.next();
ps.println(attrName.getName());
ps.println("</th>");
ps.println("</tr>");
for(int i=0; i<wdContext.nodeBapi_Salesorder_Getlist_Input().size();i++)
attributes=wdContext.getNodeInfo().iterateAttributes();
ps.println("<tr>");
IWDNodeElement ele=wdContext.getElementAt(i);
while(attributes.hasNext()){
ps.println("<td>");
DataAttributeInfo attrName=(DataAttributeInfo)attributes.next();
ps.println(""+ele.getAttributeAsText(attrName.getName()));
ps.println("</td>");
ps.println("</tr>");
ps.println("</table></body></html>");
ps.flush();
ps.close();
fos.close();
catch(Exception e){
wdComponentAPI.getMessageManager().reportException(e.getMessage(), false);
finally{
//return("Test.xls") ;
//@@end
}h action and i have return the code
its running sucessfully but am not able to perform the action plz help meHi,
You shouldn't use DataAttributeInfo as it is an internal object, if I'm correct.
Use IWDAttributeInfo instead of DataAttributeInfo and it should work
(See also API doc of IWDNodeInfo.iterateAttributes() at http://help.sap.com/javadocs/nwce/ce711sp02/wdr/com.sap.wdr/com/sap/tc/webdynpro/progmodel/api/IWDNodeInfo.html#iterateAttributes())
Cheers,
Robin -
Problem while exporting ADF table to excel
Hello,
I have some columns of random size which are left padded with 0.
now the problem comes when I export the table containing these columns to excel, excel remove all those zeros from left.
eg: 000000003726819563(table column value) after exporting to excel shows as 3726819563.
Along with this I also want the footer part of table in excel.
For some of the columns I have summary filed(i.e. sum) at the footer of the table which I want to show in excel.
Can someone please guide me through these issues.
Thanks in advance.Take a look at this: http://adfreusablecode.blogspot.com/2012/07/export-to-excel-with-styles.html
With this code you can export the footer: http://dl.dropbox.com/u/22312971/adf-samples/ExportToExcelDemo/ViewController/src/view/ExcelBean.java
Here is the entire demo project: http://dl.dropbox.com/u/22312971/adf-samples/ExportToExcelDemo.zip
I a few days I will update the above post.
Hope this help.
AP
Maybe you are looking for
-
SQL blocking during removal of report server from Scale-out-Deployment
I recently removed a 2012 reporting service instance from the Reporting Service Scale-out-Deployment. After I removed the server, there was a lot of blocking on the report DB for about 30 minutes. My report DB is on the same SQL instance as my TFS d
-
Bluetooth is not working with Windows 8.1 on U410 touch
Hello, I have a Lenovo U410 touch, and i just upgraded to windows 8.1 though the store. And the bluetooth is not working at all, it says that the PC is searching for Bluetooth devices. While everything was working great before. I have updated all the
-
string sProduct = "SELECT * FROM tbl_Product"; string sCustomer = "SELECT * FROM tbl_CustomerInfo WHERE type = 'vip'"; try if (cbvipcus.Checked == true) dtVipCustomer = FillComboBoxDat
-
Hello, I recently was sent a replacement iPhone 4 from apple. I originally had it assigned to a laptop with an older version of iTunes and everything worked fine. I recently purchased a new laptop and assigned the new laptop to my phone with the newe
-
Dubug In Jdeveloper 10.1.3
Hi , Does anybody knows how to debug in JDeveloper 10.1.3 because, i tried to put breakpoint in the .java files its showing me breakpoint mark, but while debugging the code , it execution not halt at the breakpoint. Is there any setting that i should