Read Excel cells - part2
This is a follow up from my question last week. I am back to trying to figure out how to read excel data cells and store the values into variables. I've looked through the sample files and copied the code from excel2000demo.cws. I can't actually run this demo since I don't have excel on my system. I need to be able to read the .xls without having Excel loaded. I've put ReadDataFromExcel into my program but when I try and run it, I get an error code(negative) at the Excel_WorksheetRange statement. The error is invalid handle. The line is:
error = Excel_WorksheetRange (ExcelWorksheetHandle, NULL, MyCellRangeV, CA_DEFAULT_VAL, &ExcelRangeHandle);
I don't really understand what the parameters are or should be and if certain things need to be defined elsewhere.
It also seems like I should have code to tell it what file to look into. The demo uses Excel_WorkbooksOpen. Is that ok to use with no Excel? I did try adding:
GetProjectDir (fileName);
strcat(fileName, "\\exceldem.xls");
error = Excel_WorkbooksOpen (ExcelWorkbooksHandle, NULL, fileName, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, &ExcelWorkbookHandle);
I get invalid handle errors here too.
Mike
Unfortunately you cannot run this example without having installed Excel on your system, since the instrument driver it relies on is nothing but an ActiveX interface to the local Excel application.
In effect, if you look into the source code for this example, you will notice that the very first operation performed is to connect to Excel: this instruction will fail if the application is not installed, so all the following code cannot be executed. You will notice that every opening function in the source code relies on an handle provided from a preceding statement, in a continuous chain whose first element is exactly the connection to the Excel app: this is valid for ExcelWorksheetHandle, ExcelWorbookHandle and all the handles used in the code.
Edit: Eren has come first!
Message Edited by Roberto Bozzolo on 04-28-2010 07:22 AM
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?
Similar Messages
-
Read excel cell when excel is already open
Hello,
I want to read a specific cell of a sheet with excel already open. Labview has only to read the cell and not have to open excel.
I have several examples that show :
Labvview open excel
select excel file
select workbook
select sheet
select cell
read cell
close workbook
close excel
In my vi i only need the step 3 to 6
Thank for your help
Djamel
Solved!
Go to Solution.The attached (LabVIEW 2012) vi will return the value in the cell 'A1' of 'Sheet1' of the already open excel workbook 'book1'
Change the values for your specific names of workbook and worksheet and required cell.
The value returned is a variant so need to be converted with 'Variant to Data' according to data type
Ken
Attachments:
Get cell value from already open Excel.vi 18 KB -
Hello
I would like to link a pdf file to an excel file so that I can set some anchor points in the pdf file that will allow the pdf to change the value of these anchor points whenever the cells' values in excel change.
Is there any way or any software to do this?
Thankshi,
well you are saying that your excel file contains the name of the file which is stored at somewhere in your root directory structure?..........if is it so then do you want to store the name of the file which is specified in the excel cell, to oracle database as BLOB or CLOB or you want to read the actual content available in the doc or excel file and then store it to oracle database? please verify........
this is possible using poi.....visit the apache's website for more information on POI api and downloads.......
thanks
shishir -
Hi,
How can I read a specific excel cell via Web Dynpro ?
It will be great if someone will provide a short sample of code for that ...
10x in advance
HadarHi Chandran i followed you steps regarding to upload excel sheet data to webdynpro table.
but iam not get clarity how to do this step.
Note : You cannot Read the Content from the excel file directly
First You Have to copy that file to the Server,
And from the Server you can get the file absolute path
With the absolute path you can read the contents of the Excel file
You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
help me onthis step, i need to develop the this feature in application.
you posted like this
Hi
First You have to download the jxl.jar file. You can get this file from the Below site
JExcelApi v2.6.4 (1747kbytes)
It will be in Compressed Fromat So Unzip it to get the Contents
After Unzipping The File You will get a Folder (jexcelapi/jxl.jar)
Now in NWDS open web dynpro explorer, Right Click Your Project, a popup menu will appear and in that click Properties
You will get window displaying your Project Properties
On Left Side of the window You Will Find "Java Build Path"
Click That "Java Build Path" and you will get 4 Tabs Showing ( Source,Projects,Libraries,Order and Export)
Click Libraries Tab
You will find options many options buttons
In that click the Button "Add External Jars"
You will get Window in order to fecth the jxl.jar file from the location you had stored
After selecting the jxl.jar i will get displayed and click ok
Now Open Navigator
Open Your Project
You will find Lib folder
Copy the jxl.jar to that lib folder
Note : You cannot Read the Content from the excel file directly
First You Have to copy that file to the Server,
And from the Server you can get the file absolute path
With the absolute path you can read the contents of the Excel file
You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
You have Upload the Excel file from the Server Using the File Upload UI Element
This Coding will extract 3 columns from the Xls File
Coding
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import com.sap.fileupload.wdp.IPrivateFileUpload_View;
import com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource;
public void onActionUpload_File(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_File(ServerEvent)
IPrivateFileUpload_View.IContextElement element1 = wdContext.currentContextElement();
IWDResource resource = element1.getFileResource();
element1.setFileName(resource.getResourceName());
element1.setFileExtension(resource.getResourceType().getFileExtension());
//@@end
public void onActionUpload_File_in_Server(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_File_in_Server(ServerEvent)
InputStream text=null;
int temp=0;
try
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName().toString());
FileOutputStream op = new FileOutputStream(file);
if(wdContext.currentContextElement().getFileResource()!=null)
text=wdContext.currentContextElement().getFileResource().read(false);
while((temp=text.read())!=-1)
op.write(temp);
op.flush();
op.close();
path = file.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess(path);
catch(Exception e)
e.printStackTrace();
//@@end
public void onActionUpload_Data_into_Table(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_Data_into_Table(ServerEvent)
try
Workbook wb =Workbook.getWorkbook(new File(path));
Sheet sh = wb.getSheet(0);
//wdComponentAPI.getMessageManager().reportSuccess("Columns = "+sh.getColumns());
//wdComponentAPI.getMessageManager().reportSuccess("Rows = "+sh.getRows());
int columns = sh.getColumns();
int rows = sh.getRows();
int i=0;
for(int j=1;j<=rows;j++)
ele=wdContext.nodeTable_Data().createTable_DataElement();
Cell c1 = sh.getCell(i,j);
ele.setTab_Name(c1.getContents());
Cell c2 = sh.getCell(i+1,j);
ele.setTab_Degree(c2.getContents());
Cell c3 = sh.getCell(i+2,j);
ele.setTab_Percentage(c3.getContents());
wdContext.nodeTable_Data().addElement(ele);
catch(Exception ex)
wdComponentAPI.getMessageManager().reportSuccess(ex.toString());
//@@end
The following code section can be used for any Java code that is
not to be visible to other controllers/views or that contains constructs
currently not supported directly by Web Dynpro (such as inner classes or
member variables etc.). </p>
Note: The content of this section is in no way managed/controlled
by the Web Dynpro Designtime or the Web Dynpro Runtime.
//@@begin others
String path;
IPrivateFileUpload_View.ITable_DataElement ele;
//@@end
Regards
Chandran S -
Read Excel cell data automatically
From the given examples, before reading an excel data, you have to specify the start cell and the end cell number. Is there a method to read out excel data just by giving the file name?
DavidWell, then you can open Excel, open the first sheet in the collection and then iterate into the sheet and search for non-empty cells.
You can use the source code for ExcelRpt_ReadDataToTableControl () function into excelreport.c code as a guideline to develop your own function: iterate on all cells in the sheet and try to load only those that do not return CAVT_EMPTY in CA_VariantGetType () function.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Read an Excel cell using LabView
Hello,
I'm trying to read Excel cells with LabView, witch can be numeric data
or text.
I want to chose the Excel cell to read.
I try to use AtiveX commands in order to do so, but it doesn't work,
and I don't understand all concepts of activeX.
I searched on the web, but I didn't find any simple example witch can
run for me.
Can we do it without activeX commands?
Do you have any simple example to send me?
Thank you for your help.
Jean-Louis, France.Here is a simple VI that uses ActiveX to read an Excel cell. It is set up for string values, but it can be changed. If you get a broken run arrow, than you may have to reconfigure some of the propery nodes for your version of Excel.
Attachments:
Get_Excel_Cell_Sub.vi 99 KB -
Using Lab view ver 6,How can I read a cell of excel file right after I write to it
How can I read a specif cell of an Excel file using Labview VI.
Hi,
Attached is a LV6.1 VI which will read a cell.
It will be looking for a sub VI found in the example C:\Program Files\National Instruments\LabVIEW\examples\comm\ExcelExamples.llb.
The returned value is a string value but there is no reason why it couldn't be a number. Just connect a numeric to the type connector of the Variant to Data function.
Hope this helps.
Regards
Ray Farmer
Regards
Ray Farmer
Attachments:
Get_Cell_Value.vi 41 KB
Write_Table_To_XL.vi 101 KB -
Read all cells from an Excel file?
Hi!
I'm trying to read every cell from an Excel spreadsheet file, e.g.
test.xls. The example in the NI Dev Zone (ActiveX Read Cells from
Excel2000 VI) works if you know in advance what the first and last cell
are, e.g. A1 and E453.
The trouble is that the number of rows & columns in the file will vary;
the last cell of 1 file might be E453, another might end at F29.
How can I programmatically read every cell in the file? I thought of 2
approaches:
1: Find an ActiveX property that returns the last cell (or last row and
last column).
2: Use some other way to read an .xls file, maybe not by launching Excel
but by using another program ...
The NI applications engineer couldn't find a reasonably easy solution,
so I'd w
elcome any input.
Thanks! MarkMark,
I haven't been able to find out if there is an ActiveX property or method the excel exposes to be able to do this ... searching on http://msdn.microsoft.com didn't return anything particularly useful.
I've tried this sort of thing a couple of different ways. The simplest is if I have control over the file generation code, in that case I've just used the first row A1 and B1 to contain the number or rows and columns respectively and moved on from there.
If that isn't a possibility then you could enter nonsense data around the acutal data and then look for that and then resize the array. This could get pretty slow if you read row by row, I've somtimes read chuncks of rows and then adjusted the next read and and combined arrays. With a large data set the memory and s
peed implications do need to be looked at.
The last thing is what you are referring to in 2. You should be able to save the .xls file as a comma delimited file. In this case the "Read for Spreadsheet File" vi should be able to just read all the data in. I'm not sure how easy it is to export an .xls file to a comma delimited format programatically.
I think this should work all though I haven't tried it. If it doesn't then you could just read one row and then count the number of commas to determine the number of columns. You can then read the entire file and convert the data into an array, as every comma would separate each column and a carriage return would seperate each row.
Haven't got LabVIEW on this machine so if I find anything new tomorrow I'll post again.
Kamran -
Hi all,
I want to read multiple cells from excel C1:C2 but I get the variant result:
Value -> Array(Non Displayable)
When I removed string C2 to read cell C1 the result is OK.
Does anybody know the solution?
Thanks in advance.
NacNud
Using LabVIEW 8.5
Sorry for the duplicate image. Don't know how to remove this.
Attachments:
Movie strip path.vi 13 KB
Movie excel edit.vi 53 KB
Movie date.xls 16 KBHmmm...
Solved it myself. The variant is not represented with a probe.
The solution was to convert the variant data to an 2D array and then probe it.
See attachement for the solution.
NaNud
Message Edited by excel read multiple cells on 05-18-2010 11:44 AM
Attachments:
Movie excel edit.vi 54 KB -
Help needed with referencing single Excel cells and formatting resulting text
In InDesign CS5 I am putting together a 20pp catalogue of about 200 products. The plan is to have the product information, SKU code, quantity etc fixed, but have the prices (there are two i.e. pack price and individual price) being linked to an Excel spreadsheet. This is so that the prices can be updated in the Excel file and the InDesign file will pull the new prices through. In case you are wondering why I don't pull the whole set of information through, this is because there are a lot of copywriting changes done to the information once it's in InDesign - it's only going to be the prices that will be updated.
I am planning on having two single cell tables in their own text frame, duly formatted with cell style, table style and paragraph style for the two price variables. This I am then going to have to repeat 200 times making sure I link to the next row down in Excel. This is going to be a hideous task but I see know way of modifying the cell in InDesign to point it to the next row in Excel. That's my first problem.
My second problem is this. In the Excel sheet, the prices are formatted as UK currency and are therefore like this...
£2.00
£0.40
£1.43
£9.99
£0.99
£0.09
What I will require is once I import that data (and refresh the data via a newly saved Excel file) is that the prices end up like this...
£2.00
40p
£1.43
£9.99
99p
9p
So if the value is lower than £1.00 it needs a trailing 'p' added and the leading zero and '£' sign stripped off. If the value is lower than £0.10 it also needs the zero after the decimal point stripping off.
Then formatting wise, the '£' sign needs to be superscripted and the same for the 'p'. This I am assuming could be done via GREP?
In summary, can anyone help with the first task of referecing the Excel cells on a cell by cell basis, given that it is the same cell column each time, but the next row down, and also point me in the right direction of the price formattting issues.
Any help will be gratefully received.I would do this:
Create on line with the formatting.
Export as InDesign tagged text (TXT)
Read out these tags
In Excel exists a function to connect text from several cells and predfined text, there connect the content from cells with the paragraph styling tags. Do it in a seperate sheet. (Better would be to use a database like Access, there you can link your Excel sheet).
Export this sheet as txt file
Place this sheet as tagged text (there is an option in one of the sialog boxes).
In preferences < file handling you can specify that Tablecalculation Sheets and text is not embedded but linked, turn it on. -
How to populate arrayList values in a Excel cell using java
Hi ,
Iam trying to create Excel sheet using java with Apache-POI api's.I need to display values from an arrayList into Excel cell as drop down.kindly suggest me any idea or share any code if u have any.
Thanks in advance
Regards
RajeshI suggest you use google to find examples.
-
Adapter module to read excel file -java code required for PI 7.1
Hi PI experts,
I am working on PI 7.1 SP 08.
I am trying to develope an adapter module to read excel file
http://wiki.sdn.sap.com/wiki/display/ABAP/AdapterModuleToReadExcelFilewithMultipleRowsandMultiple+Columns
but here in this wiki , given java code is for pi 7.0 and it is using jar file from PI 7.0
I tried with using corresponding PI 7.1 files
com.sap.aii.af.lib.mod.jar:
sap.comtcloggingjavaimpl.jar:
com.sap.aii.af.svc_api.jar:
com.sap.aii.af.cpa.svc_api.jar:
com.sap.aii.af.ms.ifc_api.jar:
jave program is not throwing any error in NWDS but After deploying file on server.
i am getting this errot in communication channel
2009-12-15 15:47:08 Information AO: Now calling the Convert Method to convert Excel to XML.
2009-12-15 15:47:08 Error MP: exception caught with cause javax.ejb.TransactionRolledbackLocalException: nested exception is: java.lang.RuntimeException: java.lang.UnsupportedClassVersionError: Bad version number in .class file; nested exception is: javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.UnsupportedClassVersionError: Bad version number in .class file; nested exception is: javax.ejb.EJBTransactionRolledbackException: nested exception is: java.lang.RuntimeException: java.lang.UnsupportedClassVersionError: Bad version number in .class file; nested exception is: javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.UnsupportedClassVersionError: Bad version number in .class file
since i am not a JAVA expert so i am unable to resolve this error
if some one has already deployed this module for PI 7.1, then please provide me java code for PI 7.1
Thanks
sandeep sharmahi,
please try this:
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
XMLPayload xpld = msg.getDocument();
Workbook wb = Workbook.getWorkbook((InputStream) xpld.getInputStream());
xmldata ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"+ "<ns0:"msgType" ""xmlns:ns0=\""nameSpace+"\">";
Cell[] cells ;
Cell[] cellNames ;
cellNames = wb.getSheet(0).getRow(0);
for(int j=1;j<wb.getSheet(0).getRows();j++)
xmldata = xmldata+"<Record>";
cells = wb.getSheet(0).getRow(j);
for(int i=0;i<wb.getSheet(0).getColumns();i++)
xmldata = xmldata"<"cellNames<i>.getContents()">"cells<i>.getContents()"</"cellNames<i>.getContents()+">";
xmldata = xmldata+"</Record>";
xmldata = xmldata"</ns0:"msgType+">";
wb.close();
byte byt[] = xmldata.getBytes();
xpld.setContent(byt);
inputModuleData.setPrincipalData(msg);
Thanks,
Mayank -
Hi All,
I have a requirement to read records from an excel to an internal table.I am using FM
KCD_EXCEL_OLE_TO_INT_CONVERT to read excel.
My problem arises when the program comes across a cell which contains some formulae assigned to it.
The FM does not read the value in the specified cell and throws a runtime-error.
Please help me out .
Thanks and regards
Dinesh beheraHi,
Try this one.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = v_file
i_begin_col = 1
i_begin_row = 2
i_end_col = 11
i_end_row = 10
TABLES
intern = it_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*looping the table
LOOP AT it_excel INTO wa_excel.
*coloum wise diffrensiate the internal table data
CASE wa_excel-col.
WHEN '0001'.
wa_input-tcode = wa_excel-value.
WHEN '0002'.
wa_input-vendor = wa_excel-value.
WHEN '0003'.
MOVE: wa_excel-value TO wa_input-inv_date.
WHEN '0004'.
MOVE: wa_excel-value TO wa_input-inv_no.
WHEN '0005'.
MOVE: wa_excel-value TO wa_input-post_date.
WHEN '0006'.
MOVE: wa_excel-value TO wa_input-comp_code.
WHEN '0007'.
MOVE: wa_excel-value TO wa_input-acc.
WHEN '0008'.
MOVE: wa_excel-value TO wa_input-cost_center.
WHEN '0009'.
MOVE: wa_excel-value TO wa_input-amt.
WHEN '0010'.
MOVE: wa_excel-value TO wa_input-int_ord.
ENDCASE.
*At end of every row append the excel data into table it_data
AT END OF row.
APPEND wa_input TO it_input.
CLEAR wa_input.
ENDAT.
ENDLOOP. -
How to fix the excel cell length in the sap
hi
i want to fix the excel cell length in the sap. how to fix
perform fill_cell1 using l_row l_col 1 wa_cat-seltext_l.
i want to fix the fill_cell1 how to do.
Regards,
sivakumarhi
good
go through this
The following thread has the code which will put data into multiple sheets
Download to multiple sheets in Excel
FOR COLOR LOGIC JUST REFER THIS PROGRAM
*& Report ZNEGI17 *
REPORT ZNEGI17 NO STANDARD PAGE HEADING.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
handles for OLE objects
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
TABLES: SPFLI.
DATA H TYPE I.
table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*& Event START-OF-SELECTION
START-OF-SELECTION.
read flights
SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
display header
ULINE (61).
WRITE: / SY-VLINE NO-GAP,
(3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
ULINE /(61).
display flights
LOOP AT IT_SPFLI.
WRITE: / SY-VLINE NO-GAP,
IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
ENDLOOP.
ULINE /(61).
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-007
EXCEPTIONS
OTHERS = 1.
start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-008
EXCEPTIONS
OTHERS = 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.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL1 USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL1 USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL1 USING 1 3 1 'Von'(003).
PERFORM FILL_CELL1 USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL1 USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - start
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #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'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL1 USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL1 USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL1 USING 1 3 1 'Von'(003).
PERFORM FILL_CELL1 USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL1 USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - end
disconnect from Excel
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
FORM FILL_CELL1 USING I J BOLD VAL.
data : color(5) type x value 'H80000008'.
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 'ColorIndex' = 3 .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
*& Form FILL_CELL1
text
-->P_H text
-->P_1 text
-->P_0 text
-->P_IT_SPFLI_CARRID text
form FILL_CELL using I J BOLD 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.
endform. " FILL_CELL1
thanks
mrutyun^ -
HOW TO PRINT THE EXCEL CELL COMMENT IN JAVA SWING FRAME ?
How to print the excel cell comment in java swing frame
user can print the data of cell with comment in bracket in java swing frame.
please make one java code to read an excel spreed sheet and print the output in Java swing frame as follows
EMP NO - 1, 2, 3
EMP NAME - aname (amitesh:very good), bname (amitesh: average), cname (amitesh: very bad)
EMP AGE - 11, 22, 33
EMP DESG - ad, bd, cd
Note: the bracket portion is the excel comments put in that cellhello everyone i'm new to this forum..how are you all...
Jack Brosnan
[mobile phone|http://www.mobilephonesforsale.net.au/apple-iphone-f-2.html]
Maybe you are looking for
-
Problem Installing 817 on Windows 2000 with RAID Array
I am having a problem installing Oracle under windows 2000 which has 2 x 60 GB discs configured in RAID array. When I run the setup program the cursor goes busy for about 10 seconds and returns back to normal and nothing happens !. No errors nothing.
-
I have a MacBook Pro 13.3 inch from 2010. It came with 160/SD. I replaced it 3 years ago with a 750GB Seagate which just died per Apple genius. BUt, need to replace it now. Can I replace with a 1TB or only another 750GB?
-
Why does Epson app for the iphone show a folder that has been deleted from my camera roll?
Why does the Epson app for my iphone 4 show a folder that has been deleted from my camera roll for months now?
-
Dynamic Quorum and new DAG (no CNO)
With Exchange 2013 SP1 on Windows 2012 R2, you can create a DAG without a CNO. Which is great, I no longer need a CNO or IP address for my DAGs. Which should make it much simpler to have a stretched DAG. However without the CNO, I cannot figure ou
-
Unsupported construct or internal error (2601)
Hi all, I use forms6i patch 17 with Oracle8i Enterprise Edition Release 8.1.7.4.1 . My four datablocks are based on packaged stored procedures , and yesterday I modified the packaged stored procedure source block and some of the package procedures an