FORMAT Excel Colums using ABAP
Hi ,
I need to format excel rows and columns .
Ex: I need to add border to the entire table and not just the title .
I used CALL METHOD of wf_range 'BorderAround'
EXPORTING
1 = 1
2 = 4 .
This puts a box around the cell. What i want to do this for multiple cells and not handle it at for each cell.
like if my range is E1 to F3 then border is around ever cell. A2 A3 F2 F2 and not just around A2 to F3.
Please help
Hi.
You can record macros in excel and look at generated visual basic code. Then you should convert it into ABAP code.
Similar Messages
-
How to upload an excel file using ABAP.
Hi,
Can anyone please help me in understanding how to upload an excel file using ABAP.
Thanks!!http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table/
check the link
TYPES: Begin of t_record,
name1 like itab-value,
name2 like itab-value,
age like itab-value,
End of t_record.
DATA: it_record type standard table of t_record initial size 0,
wa_record type t_record.
DATA: gd_currentrow type i.
*Selection Screen Declaration
PARAMETER p_infile like rlgrap-filename.
*START OF SELECTION
call function ALSM_EXCEL_TO_INTERNAL_TABLE
exporting
filename = p_infile
i_begin_col = 1′
i_begin_row = 2′ Do not require headings
i_end_col = 14′
i_end_row = 31′
tables
intern = itab
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e010(zz) with text-001. Problem uploading Excel Spreadsheet
endif.
Sort table by rows and colums
sort itab by row col.
Get first row retrieved
read table itab index 1.
Set first row retrieved to current row
gd_currentrow = itab-row.
loop at itab.
Reset values for next row
if itab-row ne gd_currentrow.
append wa_record to it_record.
clear wa_record.
gd_currentrow = itab-row.
endif.
case itab-col.
when 0001′. First name
wa_record-name1 = itab-value.
when 0002′. Surname
wa_record-name2 = itab-value.
when 0003′. Age
wa_record-age = itab-value.
endcase.
endloop.
append wa_record to it_record.
*!! Excel data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop. -
How to extract a query in EXCEL Form using ABAP?
Hi,
is there a way using ABAP to extract the results from a specific BW Query and save them in an EXCEL format file?Hi,
You can do it by using InfoSpoke or RSCRM_BAPI.
see in the following URL, there one blog in(https://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy)
How to transfer the Data from SAP-System to Non-SAP system without additional Cost/License
/people/surendrakumarreddy.koduru/blog/2009/03/11/how-to-transfer-the-data-from-sap-system-to-non-sap-system-without-additional-costlicense
Re: Running Quaries automatically and saving them in as a Excel file in Server
Re: Data transfer to external systems
Re: Loading from a Custom R/3 Table
Re: How can I schedule my Bex report to execute in background
Re: How can I insert the RSCRM_BAPI into Process chain?
Thanks
Reddy -
Having trouble formatting excel chart using Chart Wizard command.
Problem Description :
Trying to create an excel chart derived from an excel spreadsheet. Having trouble understanding the parameters to format in the Chart Wizard function to get the desired results. There are no error messages, just chart is not what expected.
Goal:
Chart with temperature on the left, y-axis. 3 lines on the graph for min meas temp, avg meas temp, max meas temp.
Bottom x-axis should contain year/month values.
Chart Wizard command:
status = ExcelRpt_ChartWizard (chart_temperature_handle, chart_data_worksheet_handle, D1:G3, ExRConst_GalleryLine, ExRConst_Rows, 0, 0, 0, 1, "Temperature Stats", "Year/Month", "Temp F", NULL)
NI Software : LabWindows/CVI version 8.0.1
NI Hardware : None device
Driver Version :
OS : Windows XP
Customer Information :
Mary Claflin
Technology Kitchen Corporation
US
[email protected]
Ph: (512) 965-4722Hi Mary,
Looking at the Chart Wizard within Excel, it appears as though the only
chart type that allows us to give a series of values for our XAxis
would be the XY Scatter plot. There IS an option for this when using
the CVI Excel Report function calls (specifying
ExRConst_GalleryXYScatter for the plot type).
However, it appears that there are not any Excel report chart functions
available in CVI to specify anything other than the general "series"
object. When this object is sent through as a variant data type to
Excel, Excel appears to automatically convert this single object into
separate data series. This is because Excel is not immediately aware
that we are attempting to use a Scatter plot, and thus must convert
each column into a separate series. There is no object defined in the
Excel report that would be able to handle the "Xseries" and "Yseries"
option that are seen in the chart creation wizard within Excel. Thus,
we have no way of specifying a different set of data for our XAxis.
It appears as though, at least for our own CVI functions, that there is
no way to accomplish your goal. Since CVI is based around C - we CAN
call any ActiveX client registered on the system. Because of this, we
should be able to talk with Excel directly without the help of the CVI
Excel Report functions, although this may be more difficult.
I haven't been able to find any specific C example code, but here is
the Excel Object Model on which calls to Excel will most likely be
based:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrconexcelobjectmodeloverview.asp
Sorry for the inconvenience Mary.
Dan Weiland -
How to format excel attachment through ABAP?
Hi Experts,
I am using FM ''SO_DOCUMENT_SEND_API1' to generate an email with excel attachment. Does anybody know if there is any way to format the contents of excel attachment? For example, framing, coloring or making the fields bold etc.
Any inputs will be helpful.
Thank you,
AmolHi,
Check this blog.
Downloading data into Excel with Format Options
Thanks,
Sree. -
How to upload excel file in Webdynpro application using ABAP
Hi Experts,
Am developing a webdynpro application in which it will take an excel file as input and display the contents in the form of a table in output. I am able to upload tab delimited text file and populate the table using the below code but not able to do the same with .xls file. Pls let me know if I need to use a different function module for upload excel file.
get single attribute
wd_context->get_attribute(
EXPORTING
name = `DATASOURCE`
IMPORTING
value = l_xstring ).
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.
Bind With table Element.
LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
READ TABLE fields INTO lv_field INDEX 1.
fs_table-name = lv_field.
READ TABLE fields INTO lv_field INDEX 2.
fs_table-age = lv_field.
APPEND fs_table TO t_table1.
ENDLOOP.
lo_nd_data = wd_context->get_child_node( 'DATA_TAB' ).
lo_nd_data->bind_table( T_TABLE1 ).
Thanks,
SubathraDear Exports
Can anyone guide me how to uplode the .xlsx or ..xls formatted excel file using abap webdynpro without converting it to .txt file. Because my client requirement is only to upload the excel file. because to convert the .xlsx flie to .txt file it will be time taking and cost expanssive. Another requirement is suppose today i have create a application for uploading a file which has 8 columns and 10 rows. suppose tomorrow the client will make some changes in that flat file means the client will add 2 extra columns and 10 more columns in that fil. and will upload that file. Then the new file will be display on the browser or old file. but my requirement is to display the new file in browser.
Can anyone kindly help to solve my problem. I am completely fresher in this field and I need to do it as soon as possible. Please help to solve the problem.
Regards
Rashmita -
Create a check box in excel cell using sap abap
Dear Sap Master's,
Please give me some idea on how to create a check box in excel cell using abap program..
(OLE concept).
Thanks
Moderator message: please search for available information first.
Edited by: Thomas Zloch on Jan 12, 2012select the cell then open the cell formatter:
process should be similar in the iOS version. I do not have any iOS devices with Numbers so I cannot check. I did find this link that may help:
http://support.apple.com/kb/PH3374?viewlocale=en_US -
Read large Excel cell content using ABAP class i_oi_spreadsheet
Hello,
I am trying to read an excel file using ABAP methods of interface i_oi_spreadsheet.
Unfortunetly some of my cells contain data that exceeds the 256 characters size.
To retrieve the content of the excel speadsheet, I am using method get_ranges_data.
Unfortunetly as the returned structure is of type soi_generic_table, the content of the cell is truncated to the maximum limit of 256.
Is there a way to read cells with large content ??
Thanks
Regards
Jean-PierreSame problem for me on ECC 6.0. Hope for a solution.
-
HOW CAN I ADD NEW WORKSHEET(TAB) TO EXCEL USING ABAP pROGRAM?
i want to add new tabs to my excel file using abap.... can someone help me on this?
hi,
PERFORM add_worksheet USING 'Test 1'.
*& Form ADD_WORKSHEET
FORM add_worksheet USING i_name.
Add new worksheet
IF g_first_ws <> 'N'.
g_first_ws = 'N'.
GET PROPERTY OF g_excel 'ACTIVESHEET' = g_worksheet.
ELSE.
CALL METHOD OF g_worksheets 'Add' = g_worksheet.
ENDIF.
SET PROPERTY OF g_worksheet 'NAME' = i_name.
g_row = 1.
g_col = 1.
ENDFORM. " ADD_WORKSHEET -
Create heck box in excel cell using sap
Dear Sap Master's,
Please give me some idea on how to create a check box in excel cell using abap program..
(OLE concept).
Thanks,
Naveen.
Moderator message: please do some research before posting, show what you have done yourself when posting.
Edited by: Thomas Zloch on Jan 17, 2012Not resolved
-
Hi
i would like to know on how to format excel spreadsheet using jexcel API once the program write an excel file i.e.(format column width, fill the cell with color).
im a newbie in jexcel API.
could anybody help me?
thanks in advance.
Message was edited by:
lesbonThese JExcel questions do not belong here.
They belong somewhere like http://support.teamdev.com/category.jspa?categoryID=14 -
Format Excel sheet - Oracle COM Automation
Dear gentlemen,
I would like to get your help to generate a formatted excel sheet using Oracle COM Automation, I may don’t know the correct properties to use, or don’t know how to use it.
For example:
To set a cell value I use this line:
hresult:=Ordcom.SetProperty(RangeHandle, 'Value', data, 'BSTR');
and when I tried to fill the same cell with a yello color I used this line:
hresult:=Ordcom.SetProperty(RangeHandle, 'Interior.Color', 65535, 'BSTR');
but that has no effect at all, so please advise what is wrong, this may apply also for the most properties such as “Font.Bold”.
I appreciate so much any help from you.
Best regards,
NabilHere is another version of my package ORDExcelSB. It includes almost all the formatting needs in Excel.
Package Specification:_
CREATE OR REPLACE PACKAGE ORDExcelSB AS
/* Saubhik: These constants are added */
BorderEdgeLeft CONSTANT BINARY_INTEGER:= 7;
BorderEdgeTop CONSTANT BINARY_INTEGER:=8;
BorderEdgeBottom CONSTANT BINARY_INTEGER:=9;
BorderEdgeRight CONSTANT BINARY_INTEGER:=10;
BorderInsideVertical CONSTANT BINARY_INTEGER:=11;
BorderInsideHorizontal CONSTANT BINARY_INTEGER:=12;
/* Declare externally callable subprograms. */
/* Start: These functions are newly aded by Saubhik Banerjee */
FUNCTION CreateExcelApplication(servername VARCHAR2) RETURN binary_integer;
FUNCTION OpenExcelFile(filename VARCHAR2, sheetname VARCHAR2)
RETURN binary_integer;
FUNCTION SetCellColor(range varchar2, style INTEGER)
return binary_integer;
FUNCTION SetCellBorder(range varchar2, BordersIndex BINARY_INTEGER, BorderStyle BINARY_INTEGER)
return binary_integer;
FUNCTION FormatFontStyle(range varchar2, fontstyle varchar2)
return binary_integer;
FUNCTION FormatFontColor(range varchar2, fontcolor INTEGER)
return binary_integer;
FUNCTION FormatFontName(range varchar2, fontname varchar2)
return binary_integer;
FUNCTION FormatFontSize(range varchar2, fontsize INTEGER)
return binary_integer ;
/* End: These functions are newly aded by Saubhik Banerjee */
FUNCTION CreateExcelWorkSheet(servername varchar2) return binary_integer;
FUNCTION InsertData(range varchar2, data binary_integer, type varchar2)
return binary_integer;
FUNCTION InsertDataReal(range varchar2,
data double precision,
type varchar2) return binary_integer;
FUNCTION GetDataNum(range varchar2) return binary_integer;
FUNCTION GetDataStr(range varchar2) return varchar2;
FUNCTION GetDataReal(range varchar2) return double precision;
FUNCTION GetDataDate(range varchar2) return date;
FUNCTION InsertData(range varchar2, data varchar2, type varchar2)
return binary_integer;
FUNCTION InsertData(range varchar2, data Date, type varchar2)
return binary_integer;
FUNCTION InsertChart(xpos binary_integer,
ypos binary_integer,
width binary_integer,
height binary_integer,
range varchar2,
type varchar2) return binary_integer;
FUNCTION SaveExcelFile(filename varchar2) return binary_integer;
FUNCTION ExitExcel return binary_integer;
END ORDExcelSB;
Package Body:_
CREATE OR REPLACE PACKAGE BODY ORDExcelSB AS
DummyToken binary_integer;
applicationToken binary_integer := -1;
WorkBooksToken binary_integer := -1;
WorkBookToken binary_integer := -1;
WorkSheetToken binary_integer := -1;
WorkSheetToken1 binary_integer := -1;
RangeToken binary_integer := -1;
ChartObjectToken binary_integer := -1;
ChartObject1 binary_integer := -1;
Chart1Token binary_integer := -1;
i binary_integer;
retNum binary_integer;
retReal double precision;
retStr varchar2(255);
retDate DATE;
error_src varchar2(255);
error_description varchar2(255);
error_helpfile varchar2(255);
error_helpID binary_integer;
FUNCTION CreateExcelApplication(servername VARCHAR2) RETURN binary_integer IS
BEGIN
dbms_output.put_line('Creating Excel application...');
i := OrdCOM.CreateObject('Excel.Application',
0,
servername,
applicationToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking Workbooks...');
i := ORDCOM.GetProperty(applicationToken,
'WorkBooks',
0,
WorkBooksToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
RETURN i;
END CreateExcelApplication;
FUNCTION OpenExcelFile(filename VARCHAR2, sheetname VARCHAR2)
RETURN binary_integer IS
BEGIN
dbms_output.put_line('Opening Excel file ' || filename || ' ...');
ORDCOM.InitArg();
ORDCOM.SetArg(filename, 'BSTR');
i := ORDCOM.Invoke(WorkBooksToken, 'Open', 1, DummyToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Opening WorkBook');
i := ORDCOM.GetProperty(applicationToken,
'ActiveWorkbook',
0,
WorkBookToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking WorkSheets..');
i := ORDCOM.GetProperty(applicationToken,
'WorkSheets',
0,
WorkSheetToken1);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking WorkSheet');
ORDCOM.InitArg();
ORDCOM.SetArg(sheetname, 'BSTR');
i := ORDCOM.GetProperty(WorkBookToken, 'Sheets', 1, WorkSheetToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Opened ');
RETURN i;
END OpenExcelFile;
* Invoke the Excel Automation Server and create a Workbook object as
* well as a worksheet object
FUNCTION CreateExcelWorkSheet(servername varchar2) return binary_integer IS
BEGIN
dbms_output.put_line('Creating Excel application...');
i := ORDCOM.CreateObject('Excel.Application',
0,
servername,
applicationToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking Workbooks...');
/*i:=ORDCOM.Invoke(applicationToken, 'WorkBooks',0, WorkBooksToken);*/
i := ORDCOM.GetProperty(applicationToken,
'WorkBooks',
0,
WorkBooksToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking Add to WorkBooks...');
ORDCOM.InitArg();
ORDCOM.SetArg(-4167, 'I4');
i := ORDCOM.Invoke(WorkBooksToken, 'Add', 1, WorkBookToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
dbms_output.put_line('Invoking WorkSheets..');
ORDCOM.InitArg();
ORDCOM.SetArg('Sheet 1', 'BSTR');
/* i:=ORDCOM.Invoke(applicationToken, 'WorkSheets', 1, WorkSheetToken);*/
i := ORDCOM.GetProperty(applicationToken,
'WorkSheets',
0,
WorkSheetToken1);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.Invoke(WorkSheetToken1, 'Add', 0, WorkSheetToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
return i;
END CreateExcelWorkSheet;
* Invoke the Range method to obtain a range token. Then set the property value
* at the specified range to the data required
FUNCTION InsertData(range varchar2, data binary_integer, type varchar2)
RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.SetProperty(RangeToken, 'Value', data, type);
IF (i = 0) THEN
i := ORDCOM.SetProperty(RangeToken, 'ColumnWidth', 15, 'I2');
END IF;
i := ORDCOM.DestroyObject(RangeToken);
RETURN i;
END InsertData;
/* Saubhik: This function is added to set the cell Border */
FUNCTION SetCellBorder(range varchar2, BordersIndex BINARY_INTEGER, BorderStyle BINARY_INTEGER)
return binary_integer IS
--fontToken binary_integer;
BorderToken BINARY_INTEGER;
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
ORDCOM.InitArg();
ORDCOM.SetArg(BordersIndex, 'I2');
i := ORDCOM.GetProperty(RangeToken, 'Borders', 1, BorderToken);
i := ORDCOM.SetProperty(BorderToken, 'weight', BorderStyle, 'I2');
i := ORDCOM.DestroyObject(BorderToken);
i := ORDCOM.DestroyObject(RangeToken);
return i;
END SetCellBorder;
/* Saubhik: This function is added to set the cell background color */
FUNCTION SetCellColor(range varchar2, style INTEGER)
return binary_integer IS
--fontToken binary_integer;
DummyToken BINARY_INTEGER;
SelectionToken BINARY_INTEGER;
InteriorToken BINARY_INTEGER;
--applicationToken
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i := ORDCOM.Invoke(RangeToken,'SELECT',0,DummyToken);
i := ORDCOM.GetProperty(applicationToken,'Selection',0,SelectionToken);
i := ORDCOM.GetProperty(SelectionToken, 'Interior', 0, InteriorToken);
i := ORDCOM.SetProperty(InteriorToken, 'ColorIndex', style, 'I2');
i := ORDCOM.DestroyObject(RangeToken);
return i;
END SetCellColor;
/* Saubhik: This function is added to change the font style like Bold, Italic etc. */
FUNCTION FormatFontStyle(range varchar2, fontstyle varchar2)
return binary_integer IS
fontToken binary_integer;
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i := ORDCOM.GetProperty(RangeToken, 'Font', 0, FontToken);
IF fontstyle = 'Bold' OR fontstyle = 'Italic' OR
fontstyle = 'Underline' THEN
i := ORDCOM.SetProperty(FontToken, fontstyle, True, 'BOOL');
END IF;
i := ORDCOM.DestroyObject(FontToken);
i := ORDCOM.DestroyObject(RangeToken);
return i;
END FormatFontStyle;
/* Saubhik: This function is added to change the font style like Arial, Bookman, Century etc. */
FUNCTION FormatFontName(range varchar2, fontname varchar2)
return binary_integer IS
fontToken binary_integer;
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i := ORDCOM.GetProperty(RangeToken, 'Font', 0, FontToken);
i := ORDCOM.SetProperty(FontToken, 'Name', fontname, 'BSTR');
i := ORDCOM.DestroyObject(FontToken);
i := ORDCOM.DestroyObject(RangeToken);
return i;
END FormatFontName;
/* Saubhik: This function is added to change the font style like Arial, Bookman, Century etc. */
FUNCTION FormatFontSize(range varchar2, fontsize INTEGER)
return binary_integer IS
fontToken binary_integer;
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i := ORDCOM.GetProperty(RangeToken, 'Font', 0, FontToken);
i := ORDCOM.SetProperty(FontToken, 'Size', fontsize, 'I2');
i := ORDCOM.DestroyObject(FontToken);
i := ORDCOM.DestroyObject(RangeToken);
return i;
END FormatFontSize;
/* Saubhik: This function is added to change the font color like Black, Blue etc. */
FUNCTION FormatFontColor(range varchar2, fontcolor INTEGER)
return binary_integer IS
fontToken binary_integer;
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i := ORDCOM.GetProperty(RangeToken, 'Font', 0, FontToken);
i := ORDCOM.SetProperty(FontToken, 'ColorIndex', fontcolor, 'I2');
i := ORDCOM.DestroyObject(FontToken);
i := ORDCOM.DestroyObject(RangeToken);
return i;
END FormatFontColor;
* Invoke the Range method to obtain a range token. Then set the property value
* at the specified range to the data required
FUNCTION GetDataNum(range varchar2) RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.GetProperty(RangeToken, 'Value', 0, retNum);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.DestroyObject(RangeToken);
RETURN retNum;
END GetDataNum;
FUNCTION GetDataReal(range varchar2) RETURN double precision IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.GetProperty(RangeToken, 'Value', 0, retReal);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.DestroyObject(RangeToken);
RETURN retReal;
END GetDataReal;
FUNCTION GetDataStr(range varchar2) RETURN varchar2 IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.GetProperty(RangeToken, 'Value', 0, retStr);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.DestroyObject(RangeToken);
RETURN retStr;
END GetDataStr;
FUNCTION GetDataDate(range varchar2) RETURN Date IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.GetProperty(RangeToken, 'Value', 0, retDate);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.DestroyObject(RangeToken);
RETURN retDate;
END GetDataDate;
FUNCTION InsertData(range varchar2, data DATE, type varchar2)
RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i := ORDCOM.SetProperty(RangeToken, 'Value', data, type);
i := ORDCOM.DestroyObject(RangeToken);
RETURN i;
END InsertData;
FUNCTION InsertDataReal(range varchar2,
data double precision,
type varchar2) RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i := ORDCOM.SetProperty(RangeToken, 'Value', data, type);
i := ORDCOM.DestroyObject(RangeToken);
RETURN i;
END InsertDataReal;
FUNCTION InsertData(range varchar2, data varchar2, type varchar2)
RETURN binary_integer IS
BEGIN
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
i := ORDCOM.SetProperty(RangeToken, 'Value', data, type);
i := ORDCOM.DestroyObject(RangeToken);
RETURN i;
END InsertData;
* Insert a chart at the x and y position of the spreadsheet with the desired
* height and width. Then also uses the ChartWizard to draw the graph with data
* in a specified range area with a specified charting type.
FUNCTION InsertChart(xpos binary_integer,
ypos binary_integer,
width binary_integer,
height binary_integer,
range varchar2,
type varchar2) RETURN binary_integer IS
charttype binary_integer := -4099;
BEGIN
ORDCOM.InitArg();
i := ORDCOM.GetProperty(WorkSheetToken,
'ChartObjects',
0,
ChartObjectToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
ORDCOM.InitArg();
ORDCOM.SetArg(xpos, 'I2');
ORDCOM.SetArg(ypos, 'I2');
ORDCOM.SetArg(width, 'I2');
ORDCOM.SetArg(height, 'I2');
i := ORDCOM.Invoke(ChartObjectToken, 'Add', 4, ChartObject1);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.GetProperty(ChartObject1, 'Chart', 0, Chart1Token);
ORDCOM.InitArg();
ORDCOM.SetArg(range, 'BSTR');
i := ORDCOM.GetProperty(WorkSheetToken, 'Range', 1, RangeToken);
ORDCOM.InitArg();
ORDCOM.SetArg(RangeToken, 'DISPATCH');
IF type = 'xlPie' THEN
charttype := -4102;
ELSIF type = 'xl3DBar' THEN
charttype := -4099;
ELSIF type = 'xlBar' THEN
charttype := 2;
ELSIF type = 'xl3dLine' THEN
charttype := -4101;
END IF;
ORDCOM.SetArg(charttype, 'I4');
i := ORDCOM.Invoke(Chart1Token, 'ChartWizard', 2, DummyToken);
i := ORDCOM.DestroyObject(RangeToken);
i := ORDCOM.DestroyObject(ChartObjectToken);
i := ORDCOM.DestroyObject(ChartObject1);
i := ORDCOM.DestroyObject(Chart1Token);
RETURN i;
END InsertChart;
* Save the Excel File. WARNING: Do not specify a filename that already exist
* since there is no graphical context, Oracle would not be able to pop
* out a warning message for existing file. This causes Excel to hang
FUNCTION SaveExcelFile(filename varchar2) return binary_integer IS
BEGIN
dbms_output.put_line('Saving Excel file...');
ORDCOM.InitArg();
ORDCOM.SetArg(filename, 'BSTR');
i := ORDCOM.Invoke(WorkBookToken, 'SaveAs', 1, DummyToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
RETURN i;
END SaveExcelFile;
* Close the Excel spreadsheet and exit from it
FUNCTION ExitExcel return binary_integer is
BEGIN
dbms_output.put_line('Closing workbook and quitting...');
ORDCOM.InitArg();
ORDCOM.InitArg();
ORDCOM.SetArg(FALSE, 'BOOL');
dbms_output.put_line('Closing workbook...');
i := ORDCOM.Invoke(WorkBookToken, 'Close', 0, DummyToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.DestroyObject(WorkBookToken);
ORDCOM.InitArg();
dbms_output.put_line('Closing workbooks...');
i := ORDCOM.Invoke(WorkBooksToken, 'Close', 0, DummyToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.DestroyObject(WorkBooksToken);
i := ORDCOM.Invoke(applicationToken, 'Quit', 0, DummyToken);
IF (i != 0) THEN
ORDCOM.GetLastError(error_src,
error_description,
error_helpfile,
error_helpID);
dbms_output.put_line(error_src);
dbms_output.put_line(error_description);
dbms_output.put_line(error_helpfile);
END IF;
i := ORDCOM.DestroyObject(WorkSheetToken);
i := ORDCOM.DestroyObject(WorkSheetToken1);
i := ORDCOM.DestroyObject(applicationToken);
i := ORDCOM.DestroyObject(ChartObjectToken);
i := ORDCOM.DestroyObject(Chart1Token);
i := ORDCOM.DestroyObject(ChartObject1);
i := ORDCOM.DestroyObject(dummyToken);
RETURN i;
END ExitExcel;
END ORDExcelSB; -
Make Number stored as text - in excel using ABAP
Hello all,
How can I make a value to be stored as text in excels, without adding apostrophe in front of the value using ABAP.
Im using ECC6.0 system. In erlier version 4.6C, values are displaying as numbers.
We are calling methods in RSAQEXCE dynamically in our program to get the excel.
Can any one help me in this regard.
Thanks in advance.
Best Regards,
Sasidhar Reddy Matli.Hi Sasidar,
In Excel right click the column select format cells and then select the format as text which is general by default.
Regards,
Anil. -
Formatting excel using 'SO_NEW_DOCUMENT_ATT_SEND_API1'
Hi,
I am having an issue in formatting excel content while sending as an attachment through a mail. I am using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'. I am getting an excel output as an attachment with the mail, but I would like to do formatting too in excel like add straight lines or add color to headings. Is this possible ?? I tried searching for this solution but I ain't getting anywhere. Please help if you have got any.
Regards
Raj.Hey Guys,
Thanks for the help.. but it is not useful for me. I already said I am able to get the output in excel format with data in correct column headings. I just want an example or a link where the formatting of adding vertical lines between data and coloring of headings are done before attaching to the mail.
Regards
Raj. -
Writing into Excel file using PL/SQL and formatting the excel file
Hi,
I am writing into a excel file using PL/SQL and I want to make the first line bold on the excel. Also let me know if there are any other formatting options when writing into excel.
Regards,
-AnandI am writing into a excel file using PL/SQL
Re: CSV into Oracle and Oracle into CSV
check that thread or search in this forum...
Maybe you are looking for
-
Backing up files from the iPad
I'm buying an iPad Retina tomorrow. I will be traveling with it shortly, and will be storing images from my camera to the iPad via a Lightning USB connector. Does this connector work the other way too? I.E. can I attach an external USB key to the co
-
Hi Can someone suggest a better way to start with PAPI usage. may be a beginners guide in a precise way.. or a sample project that i can carryout locally on my machine without enterprise server. a guide that describes the scenarios which require PAPI
-
Dear all, Does the process of WM starts from Purchase order creation ? As per my knowledge it does starts from posting of GR'S. Please suggest your view. Regards, Rocky.
-
Hi all, I am reading about materialized view from 9i documentation. In this it is mentioned that for updatable materialized views one needs to have updatable materialized view log, but it is not given the log has to be created by us like the material
-
Calendar not showing multiple days when using Gmail option
Since I installed Mountain Lion the calendar when using the Gmail option does not show the bar (highlight ) when using multiple days. The detail transfer to My I pad perfectly and the Apple work & home are also working. If I click on the first day o