Column Headers in Excel using CLIENT_OLE2
Hello guys,
I have muti record block that has 10 columns which I want to display in Excel. I created a procedure RUN_EXCEL and everything works fine when the button is pressed and the procedure is called. However, I want to add the column prompts and when I try to do that using the prompt text I get the column headers but all the rows and colums mess up. Can anyone tell me how to get the column header to work to add in my current procedure. Right now if I run this way it doesn't display the promt headers.
Thanks
PROCEDURE RUN_EXCEL IS
application Client_OLE2.Obj_Type;
workbooks Client_OLE2.Obj_Type;
workbook Client_OLE2.Obj_Type;
worksheets Client_OLE2.Obj_Type;
worksheet Client_OLE2.Obj_Type;
args Client_OLE2.List_Type;
cell client_ole2.Obj_Type;
font client_ole2.obj_type;
range client_ole2.obj_type;
range_col client_ole2.obj_type;
item_prompt VARCHAR2(32767);
j INTEGER;
k INTEGER;
l INTEGER;
BEGIN
application := Client_OLE2.create_obj('Excel.Application');
Client_OLE2.Set_Property ( application , 'visible', 1);
workbooks := Client_OLE2.Get_Obj_Property(application, 'Workbooks');
workbook := Client_OLE2.Invoke_Obj(workbooks, 'Add');
worksheets := Client_OLE2.Get_Obj_Property(workbook, 'Worksheets');
worksheet := Client_OLE2.Invoke_Obj(worksheets, 'Add');
go_block('DM_T_EXCEPTION_LOG');
first_record;
j:=1;
k:=1;
while :system.last_record = 'FALSE'
loop
for k in 1..10 /* Table has 10 columns */
loop
If not name_in(:system.cursor_item) is NULL Then
item_prompt := get_item_property(:SYSTEM.CURRENT_BLOCK||'.'||:SYSTEM.CURRENT_ITEM, prompt_text);
args:=Client_OLE2.create_arglist;
Client_OLE2.add_arg(args, j);
Client_OLE2.add_arg(args, k);
cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
Client_OLE2.destroy_arglist(args);
Client_OLE2.set_property(cell, 'Value', name_in(:system.cursor_item));
Client_OLE2.release_obj(cell);
range := client_ole2.get_obj_property (worksheet, 'UsedRange');
range_col := client_ole2.get_obj_property (range, 'Columns');
client_ole2.invoke (range_col, 'AutoFit');
End If;
next_item;
end loop;
j:=j+1;
next_record;
end loop;
/* For the last record */
for k in 1..10
loop
If not name_in(:system.cursor_item) is NULL Then
args:=Client_OLE2.create_arglist;
Client_OLE2.add_arg(args, j);
Client_OLE2.add_arg(args, k);
cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
Client_OLE2.destroy_arglist(args);
Client_OLE2.set_property(cell, 'Value', name_in(:system.cursor_item));
-- imessage('in k again'||' '||:system.cursor_item||' '||item_prompt);
Client_OLE2.release_obj(cell);
range := client_ole2.get_obj_property (worksheet, 'UsedRange');
range_col := client_ole2.get_obj_property (range, 'Columns');
client_ole2.invoke (range_col, 'AutoFit');
End If;
next_item;
end loop;
ole2.set_property(application, 'Visible', 'false');
client_ole2.release_obj (range);
client_ole2.release_obj (range_col);
Client_OLE2.Release_Obj(worksheet);
Client_OLE2.Release_Obj(worksheets);
END;
Re: Problem area in code
"Match" is a worksheet function and is not used in VBA unless it is identified as a worksheet function, such as...
X = Application.WorksheetFunction.Match(arg, arg, arg)
Jim Cone
Portland, Oregon USA
free 'Save Selection as Picture' excel add-in
(a couple of clicks & you have a picture file of the selected cells)
https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2
Similar Messages
-
Generating Excel using Client_ole2
Hi
I am using the following codde to generate excel file from form but when i click on button nothing happens and i can not exit the form also... please help me...
thanks.....
DECLARE
A BOOLEAN;
args client_ole2.list_type;
application client_ole2.obj_type;
vworkbooks client_ole2.obj_type;
vdoc client_ole2.obj_type;
vworksheet client_ole2.obj_type;
vrange client_ole2.obj_type;
BEGIN
-- create app object
application := client_ole2.create_obj('Excel.Application');
client_OLE2.SET_PROPERTY(application, 'Visible','True');
-- get workbooks object
vworkbooks := client_ole2.get_obj_property(application, 'Workbooks');
-- and open a file
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 'c:\tp_ae.xls');
vdoc :=client_ole2.INVOKE_OBJ(vworkbooks,'Open',args);
client_ole2.destroy_arglist(args);
-- get a worksheet object
-- for this to work you need to know the sheet name or its index
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 1); --<-- name or index
vworksheet := client_ole2.get_obj_property(vdoc,'Worksheets',args);
client_ole2.destroy_arglist(args);
-- get a range object which in this case is just a cell
-- for this to work you need to know the cell coordinates
args := client_ole2.create_arglist;
client_ole2.ADD_ARG(args, 'B6');
vrange := client_ole2.get_obj_property(vworksheet,'Range',args);
client_ole2.destroy_arglist(args);
-- and here you get the value
message(client_ole2.get_char_property(vrange,'Value'));
-- release objects
client_ole2.release_obj(vrange);
client_ole2.release_obj(vworksheet);
client_ole2.release_obj(vdoc);
client_ole2.release_obj(vworkbooks);
client_ole2.release_obj(application);
END;hi
if you want to export the data to excel then use the following code and the following code u can use any schema and it will export all data with headers.
PROCEDURE fpr_forms_to_excel(p_block_name in varchar2 default NAME_IN('system.current_block'),
p_path in varchar2 default 'C:\',
p_file_name in varchar2 default 'Temp') IS
-- Declare the OLE objects
application OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
range OLE2.OBJ_TYPE;
range_col OLE2.OBJ_TYPE;
-- Declare handles to OLE argument lists
args OLE2.LIST_TYPE;
arglist OLE2.LIST_TYPE;
-- Declare form and block items
form_name VARCHAR2(100);
f_block VARCHAR2(100);
l_block VARCHAR2(100);
f_item VARCHAR2(100);
l_item VARCHAR2(100);
cur_block VARCHAR2(100):= NAME_IN('system.current_block');
cur_item VARCHAR2(100);
cur_record VARCHAR2(100);
item_name VARCHAR2(100);
baslik VARCHAR2(100);
row_n NUMBER;
col_n NUMBER;
filename VARCHAR2(1000):= p_path||p_file_name;
ExcelFontId OLE2.list_type;
BEGIN
-- Start Excel
application:=OLE2.CREATE_OBJ('Excel.Application');
OLE2.SET_PROPERTY(application, 'Visible', 'False');
-- Return object handle to the Workbooks collection
workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
-- Add a new Workbook object to the Workbooks collection
workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
-- Return object handle to the Worksheets collection for the Workbook
worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
-- Get the first Worksheet in the Worksheets collection
-- worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Add');
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 1);
worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
OLE2.DESTROY_ARGLIST(args);
-- Return object handle to cell A1 on the new Worksheet
go_block(p_block_name);
baslik := get_block_property(p_block_name,FIRST_ITEM); --commented to consider the second item as the first item
f_item := p_block_name||'.'||get_block_property(p_block_name,FIRST_ITEM); --in order to skip the old filename in the excel file
l_item := p_block_name||'.'||get_block_property(p_block_name,LAST_ITEM);
first_record;
LOOP
item_name := f_item;
row_n := NAME_IN('SYSTEM.CURSOR_RECORD');
col_n := 1;
LOOP
IF get_item_property(item_name,ITEM_TYPE)<>'BUTTON' AND get_item_property(item_name,VISIBLE)='TRUE' THEN
-- Set first row with the item names
IF row_n=1 THEN
args := OLE2.create_arglist;
OLE2.add_arg(args, 1);
OLE2.add_arg(args, col_n);
cell := OLE2.get_obj_property(worksheet, 'Cells', args);
OLE2.destroy_arglist(args);
--cell_value := OLE2.get_char_property(cell, 'Value');
ExcelFontId := OLE2.get_obj_property(Cell, 'Font');
OLE2.set_property(ExcelFontId, 'Bold', 'True');
baslik:=NVL(get_item_property(item_name,PROMPT_TEXT),baslik);
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, row_n);
OLE2.ADD_ARG(args, col_n);
cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
OLE2.SET_PROPERTY(cell, 'Value', baslik);
OLE2.RELEASE_OBJ(cell);
END IF;
-- Set other rows with the item values
args:=OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, row_n+1);
:control.message:=row_n||' Row(s) Processed.';
synchronize;
OLE2.ADD_ARG(args, col_n);
cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
OLE2.DESTROY_ARGLIST(args);
IF get_item_property(item_name,DATATYPE)<>'NUMBER' THEN
OLE2.SET_PROPERTY(cell, 'NumberFormat', '@');
END IF;
OLE2.SET_PROPERTY(cell, 'Value', name_in(item_name));
OLE2.RELEASE_OBJ(cell);
END IF;
IF item_name = l_item THEN
exit;
END IF;
baslik := get_item_property(item_name,NEXTITEM);
item_name := p_block_name||'.'||get_item_property(item_name,NEXTITEM);
col_n := col_n + 1;
END LOOP;
EXIT WHEN NAME_IN('system.last_record') = 'TRUE';
--exit;
NEXT_RECORD;
END LOOP;
-- Autofit columns
range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
OLE2.INVOKE( range_col,'AutoFit' );
OLE2.RELEASE_OBJ( range );
OLE2.RELEASE_OBJ( range_col );
-- Save as worksheet with a Specified file path & name.
IF NVL(filename,'0')<>'0' THEN
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args,filename );
OLE2.INVOKE(worksheet,'SaveAs',args );
OLE2.DESTROY_ARGLIST( args );
END IF;
-- Release the OLE objects
OLE2.RELEASE_OBJ(worksheet);
OLE2.RELEASE_OBJ(worksheets);
OLE2.RELEASE_OBJ(workbook);
OLE2.RELEASE_OBJ(workbooks);
OLE2.INVOKE (application,'Quit');
OLE2.RELEASE_OBJ(application);
-- Focus to the original location
exception
when others then null;
raise form_trigger_failure;
END; Note:- As i mentioned in my previouse posts if your webutil is not configured
so the client_ole2 will not work before using client_ole2 u have to configure webutil.
sarah -
Export to excel using client_ole2
Hi everyone
i am using the following code to write to excel
-- Start Excel and make it visible
application := CLIENT_OLE2.create_obj ('Excel.Application');
CLIENT_OLE2.set_property (application, 'Visible', 'True');
-- Return object handle to the Workbooks collection
workbooks := CLIENT_OLE2.get_obj_property (application, 'Workbooks');
--- open Workbook object to the Workbooks collection
workbook := CLIENT_OLE2.invoke_obj(workbooks, 'ADD');
-- Open worksheet Sheet1 of that Workbook
worksheets := CLIENT_ole2.get_obj_property (workbook, 'Worksheets');
worksheet := CLIENT_ole2.invoke_obj (worksheets, 'ADD');
CLIENT_ole2.set_property (worksheet, 'NAME','ΠΩΛΗΣΕΙΣ');
My problem is that in the last command when i use grek characters('ΠΩΛΗΣΕΙΣ') i get the message
WUO-712 com.jacob.com.comfailexception:invoke of name source:microsoft office excel
Any ideas?
Thanks HermesHi
finally i get the excel but with question marks in columns with greek characters.This is a nls_lang problem
Pls answer urself on these questions...
1. did u change it to Greek in ur Windows Registery... ?
2.Did - the most important - ur windows has Greek characters installed ?
if the answer is no pls make sure u have installed it and test it in a note pad before re-trying.
Hope this helps...
Regards,
Ammatu Allah. -
Not able to write to Excel using Client_OLE2 and webutil
Hi
I am working on Windows 2000 Pro SP4 Oracle Forms Builder 10.1.2.0.2
I am using webutil to invoke Excel Application .
The following code invokes Excel application and saves in the path specified as Test_Excel and writes the "Test Data to be written" to R1C1 when I use OLE2.
But when I replace OLE2 with Client_OLE2 the Excel file is getting created but the data is not written to the cell.
PL/SQL :could not find program unit being called is the error.
Can anybody help me solve this issue ?
Thanks in advance.
FUNCTION WRITE_TO_EXCEL(
excel_file_name in varchar2, ---for eg.. C:\Test_Excel.xls
buf in varchar2 ) ----Test Data to be written
return boolean is
application CLIENT_OLE2.OBJ_TYPE;
workbooks CLIENT_OLE2.OBJ_TYPE;
workbook CLIENT_OLE2.OBJ_TYPE;
worksheets CLIENT_OLE2.OBJ_TYPE;
worksheet CLIENT_OLE2.OBJ_TYPE;
cell CLIENT_OLE2.OBJ_TYPE;
args CLIENT_OLE2.LIST_TYPE;
begin
application := CLIENT_OLE2.CREATE_OBJ ('Excel.Application');
CLIENT_OLE2.SET_PROPERTY(application, 'Visible', 'True');
workbooks := CLIENT_OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
workbook := CLIENT_OLE2.Invoke_Obj(workbooks, 'Add');
worksheets := CLIENT_OLE2.Get_Obj_Property(workbook, 'Worksheets');
worksheet := CLIENT_OLE2.Invoke_Obj(worksheets,'Add');
args:=CLIENT_OLE2.create_arglist;
CLIENT_OLE2.add_arg(args,1);
CLIENT_OLE2.add_arg(args,1);
cell:=CLIENT_OLE2.get_obj_property(worksheet, 'Cells', args);
CLIENT_OLE2.destroy_arglist(args);
CLIENT_OLE2.set_property(cell,'Value', buf);
CLIENT_OLE2.release_obj(cell);
CLIENT_OLE2.Release_Obj(worksheet);
CLIENT_OLE2.Release_Obj(worksheets);
args := CLIENT_OLE2.Create_Arglist;
CLIENT_OLE2.Add_Arg(args,excel_file_name);
CLIENT_OLE2.Invoke(workbook, 'SaveAs', args);
CLIENT_OLE2.Destroy_Arglist(args);
args := CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(args,'Caption');
CLIENT_OLE2.INVOKE(application,'Run',args);
CLIENT_OLE2.destroy_arglist(args);
CLIENT_OLE2.Release_Obj(workbook);
CLIENT_OLE2.Release_Obj(workbooks);
CLIENT_OLE2.Invoke(application, 'Quit');
CLIENT_OLE2.Release_Obj(application);
return(TRUE);
exception
when others then
message (error_type||'-'||error_code||':'||error_text);
message (' ');
SET_APPLICATION_PROPERTY(CURSOR_STYLE,'default');
CLIENT_OLE2.RELEASE_OBJ(application);
CLIENT_OLE2.RELEASE_OBJ(workbooks);
CLIENT_OLE2.RELEASE_OBJ(workbook);
CLIENT_OLE2.release_obj(worksheet);
CLIENT_OLE2.release_obj(worksheets);
return(FALSE);
END;What line is actually causing the error? Also, I assume you tested the exact same code which works when using straight OLE2 (and not the webutil client_ version)?
Regards
Grant Ronald
Oracle Product Management -
JTable column headers not displaying using custom table model
Hi,
I'm attempting to use a custom table model (by extending AbstractTableModel) to display the contents of a data set in a JTable. The table is displaying the data itself correctly but there are no column headers appearing. I have overridden getColumnName of the table model to return the correct header and have tried playing with the ColumnModel for the table but have not been able to get the headers to display (at all).
Any ideas?
CheersClass PublicationTableModel:
public class PublicationTableModel extends AbstractTableModel
PublicationManager pubManager;
/** Creates a new instance of PublicationTableModel */
public PublicationTableModel(PublicationManager pm)
super();
pubManager = pm;
public int getColumnCount()
return GUISettings.getDisplayedFieldCount();
public int getRowCount()
return pubManager.getPublicationCount();
public Class getColumnClass(int columnIndex)
Object o = getValueAt(0, columnIndex);
if (o != null) return o.getClass();
return (new String()).getClass();
public String getColumnName(int columnIndex)
System.out.println("asked for column name "+columnIndex+" --> "+GUISettings.getColumnName(columnIndex));
return GUISettings.getColumnName(columnIndex);
public Publication getPublicationAt(int rowIndex)
return pubManager.getPublicationAt(rowIndex);
public Object getValueAt(int rowIndex, int columnIndex)
Publication pub = (Publication)pubManager.getPublicationAt(rowIndex);
String columnName = getColumnName(columnIndex);
if (columnName.equals("Address"))
if (pub instanceof Address) return ((Address)pub).getAddress();
else return null;
else if (columnName.equals("Annotation"))
if (pub instanceof Annotation) return ((Annotation)pub).getAnnotation();
else return null;
etc
else if (columnName.equals("Title"))
return pub.getTitle();
else if (columnName.equals("Key"))
return pub.getKey();
return null;
public boolean isCellEditable(int rowIndex, int colIndex)
return false;
public void setValueAt(Object vValue, int rowIndex, int colIndex)
}Class GUISettings:
public class GUISettings {
private static Vector fields = new Vector();
private static Vector classes = new Vector();
/** Creates a new instance of GUISettings */
public GUISettings() {
public static void setFields(Vector f)
fields=f;
public static int getDisplayedFieldCount()
return fields.size();
public static String getColumnName(int columnIndex)
return (String)fields.elementAt(columnIndex);
public static Vector getFields()
return fields;
}GUISettings.setFields has been called before table is displayed.
Cheers,
garsher -
Export JTable Column headers to Excel document
Hello all!!! I am having a small problem while trying to export some data from a jTable to an excel document.
I have a jTable and I use a custom TableModel with this:
private String[] columnNames = {"First", "Second", "Third", "Forth"};as names for each column of the table.
The thing I am trying to do is to export exactly the same "headers" from the columns of the jTable to the excel spreadsheet using Jakarta POI. Unfortunately I don't know how to do it and I haven't found anything yet on this forum. Can anyone help me with this?
In simple words I want to know how I can have the same headers from my jTable columns, with the headers from the excel doument I will create.
Many thanks in advanve!!!
KostasThank you for your reply first of all. The problem is how to get the heading text and how to put it to the excel's first row OR to excels "headings" (if it is possible...). [in other words replace A,B,C,D from the excel document with the headers I get from the jTable...] .
I hope now you can see what I am looking for... If there is no solution to this please tell me what are the alternatives. (B) could be a good example.
Thanks you very much!!
Kostas -
How to retrieve column name from Excel using POI HSSF eventusermodel?
Hi ,
I am simply reading the excel sheet and writing in a txt file. I have done the following in the switch construct. It works fine but I want to retrieve only the column header. But this code gives me all available strings in the excel sheet. Any pointer would be greatly appreciated.
case SSTRecord sid :
SSTRecord sstrecord = (SSTRecord) record;
for (int i=0; i<sstrecord.getNumUniqueStrings(); i++){
System.out.println(" Column name" + sstrecord.getString(i));
break;bye for now
Sattry labels:
case LabelSSTRecord.sid:
LabelSSTRecord lrec = (LabelSSTRecord) record;
if (lrec.getRow() == 0) {
System.out.println(" Column name "
+ sstrec.getString(lrec.getSSTIndex()));
break; -
How to change the font settings of headers in excel
how tobold the column headers in excel using RGT?
kaviduplicate post
RGT means Report Generation Toolkit...
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Export data to excel and table column headers
I noticed that with LV 2012 when I call the method "Export Data to Excel" for a table, the table headers (= column names) are not exported to excel.
Am I right? I think that the column names should be exported too...
As a matter of fact when you call the method "Export to simplified image" the column names are included
How can I export the table column names to excel?
Vix
In claris non fit interpretatio
Using LV 2013 SP1 on Win 7 64bit
Using LV 8.2.1 on WinXP SP3
Using CVI 2012 SP1 on Win 7 64bit, WinXP and WinXP Embedded
Using CVI 6.0 on Win2k, WinXP and WinXP EmbeddedIn this document there is a full description of how to export data from LabVIEW to Excel.
Using a table, the method "Export data to excel" should export the "currently selected data", and data can be programmatically selected using ActiveCell property (as described here).
With ActiveCell I can select the column headers too (using negative numbers for row and/or column), and I do this.
And so I expect that when I select "Export data to Excel", the column headers should be exported too (because I selected them!).
I think that the actual behavior is a bug, rather that an expected behavior.
Don't you agree?
Vix
In claris non fit interpretatio
Using LV 2013 SP1 on Win 7 64bit
Using LV 8.2.1 on WinXP SP3
Using CVI 2012 SP1 on Win 7 64bit, WinXP and WinXP Embedded
Using CVI 6.0 on Win2k, WinXP and WinXP Embedded -
Crystal 11.5 truncating column headers on export to excel
Hi,
We are currently (or finally as the case may be) upgrading our reports from Crystal 8.5 to Crystal 11.5 (which I know is a few versions behind but unfortunately the software that we integrate with is only compatible to 11.5).
However, I've been having a problem exporting to excel.
The column headers (which can be in a range of report header/page header/group header) are truncating to the the length that they display on the screen before the export. When I view them in crystal viewer I can see that the entire text field is available. However this does not flow through to export to excel.
I have utilised the "Can grow" formatting option however this then creates a merged field up 3 rows high in excel and the report then has problems using excel functions like sort etc.
I also attempted to use the data only option which does export the full text in the column names but then I lose the rest of my formatting.
There were no issues exporting from v8.5
I have snapped to grid.
The actual data exports without issue it is only the column headers (text) which pose a problem.
I am unable to reduce the amount of data that we include in our report to free up space to display the entire text.
I would prefer to not reduce to a 4pt text size to ensure that it exports correctly as this will have significant impacts for those people who actually export the reports.
Is anyone able to shed some light on how to resolve this issue? I've googled and searched these forums extensively but can't quite find a resolution to the issue and would really appreciate any assistance that anyone can offer me.
Kind regards
JanneIan
It works for me whether my headers are text fields or field headers. Once I export them I expand the columns and set the cells to wrap, and I get the complete contents. Ditto for the fields themselved, and text fields containing data fields.
I always export excel(97-2003)data only with Column width based on objects in the details & checking Export object formating, Maintain relative object position, Maintain column alignment, export page header and page footer, Simplify page headers.
Allow fields to grow is off on everything during exports.
Note: nearly all my reports are designed in Crystal 2008 without any SQL commands and all exports are done manually. Perhaps it is a XI.5 issue?
Edited by: Debi Herbert on Oct 5, 2011 10:07 AM -
Include Row/Column Headers in Pivot Table Export to Excel
I am using JDeveloper version 11.1.2.3
I am trying to export my pivot table to excel using dvt:exportPivotTableData. I'd like to include column/row headers in the export, but can't seem to find a way to do that. Is there a way to do this in my jdeveloper version?I am using JDeveloper version 11.1.2.3
I am trying to export my pivot table to excel using dvt:exportPivotTableData. I'd like to include column/row headers in the export, but can't seem to find a way to do that. Is there a way to do this in my jdeveloper version? -
Discoverer Export Problem - Column headers dropped & row data used instead
In Discoverer 9i, when I export the data for a 12 month period from one of my workbooks to Excel 2002, three of the twelve column headers are dropped in the spreadsheet and one piece of row data is used as a column header instead. The total number of records exported for the workbook is 33586 which is below the export limit for Excel. This problem does not happen when 11 months of data (28174 rows) is exported out to Excel. Any idea what may be causing this?
Regards,
Andrewpallen,
As usual the Express VI has its limitations. It seems to be setup for a 2D array of info in this case. The best way I've found is to name range in template and use the Excel Easy Table.vi. -
Hi my name is vishal
For past 10 days i have been breaking my head on how to make column headers in table appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp.
Given below is my code in c# on how i export datas from different tables in sql server to PDF report using iTextSharp:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.Diagnostics;
using System.IO;
namespace DRRS_CSharp
public partial class frmPDF : Form
public frmPDF()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
Document doc = new Document(PageSize.A4.Rotate());
var writer = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
doc.SetMargins(50, 50, 50, 50);
doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
doc.Open();
PdfPTable table = new PdfPTable(6);
table.TotalWidth =530f;
table.LockedWidth = true;
PdfPCell cell = new PdfPCell(new Phrase("Institute/Hospital:AIIMS,NEW DELHI", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
cell.Colspan = 6;
cell.HorizontalAlignment = 0;
table.AddCell(cell);
Paragraph para=new Paragraph("DCS Clinical Record-Assigned Dialyzer",FontFactory.GetFont("Arial",16,iTextSharp.text.Font.BOLD,BaseColor.BLACK));
para.Alignment = Element.ALIGN_CENTER;
iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
png.ScaleToFit(105f, 105f);
png.Alignment = Element.ALIGN_RIGHT;
SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Select d.dialyserID,r.errorCode,r.dialysis_date,pn.patient_first_name,pn.patient_last_name,d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.Technician_first_name,t.Technician_last_name from dialyser d,patient_name pn,reprocessor r,Techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=0 and d.closed_status=0 and pn.status=1 and r.errorCode<106 and r.reprocessor_id in (Select max(reprocessor_id) from reprocessor where dialyzer_id=d.dialyserID) order by pn.patient_first_name,pn.patient_last_name", conn);
conn.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
table.AddCell("Reprocessing Date");
table.AddCell("Patient Name");
table.AddCell("Dialyzer(Manufacturer,Size)");
table.AddCell("No.of Reuse");
table.AddCell("Verification");
table.AddCell("DialyzerID");
while (dr.Read())
table.AddCell(dr[2].ToString());
table.AddCell(dr[3].ToString() +"_"+ dr[4].ToString());
table.AddCell(dr[5].ToString() + "-" + dr[6].ToString());
table.AddCell("@count".ToString());
table.AddCell(dr[12].ToString() + "-" + dr[13].ToString());
table.AddCell(dr[0].ToString());
dr.Close();
table.SpacingBefore = 15f;
doc.Add(para);
doc.Add(png);
doc.Add(table);
doc.Close();
System.Diagnostics.Process.Start("AssignedDialyzer.pdf");
if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.Yes)
var writer2 = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
else if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.No)
this.Close();
The above code executes well with no problem at all!
As you can see the file to which i create and save and open my pdf report is
AssignedDialyzer.pdf.
The column headers of table in pdf report from c# windows forms using iTextSharp are
"Reprocessing Date","Patient Name","Dialyzer(Manufacturer,Size)","No.of Reuse","Verification" and
"DialyzerID".
However the problem i am facing is after execution and opening of document is my
column headers in table in pdf report from
c# and datas in it all appear in bold.
I have browsed through net regarding to solve this problem but with no success.
What i want is my pdf report from c# should be similar to following format which i was able to accomplish in vb6,adodb with MS access using iTextSharp.:
Given below is report which i have achieved from vb6,adodb with MS access using iTextSharp
I know that there has to be another way to solve my problem.I have browsed many articles in net regarding exporting sql datas to above format but with no success!
Is there is any another way to solve to my problem on exporting sql datas from c# windows forms using iTextSharp to above format given in the picture/image above?!
If so Then Can anyone tell me what modifications must i do in my c# code given above so that my pdf report from c# windows forms using iTextSharp will look similar to image/picture(pdf report) which i was able to accomplish from
vb6,adodb with ms access using iTextSharp?
I have approached Sound Forge.Net for help but with no success.
I hope anyone/someone truly understands what i am trying to ask!
I know i have to do lot of modifications in my c# code to achieve this level of perfection but i dont know how to do it.
Can anyone help me please! Any help/guidance in solving this problem would be greatly appreciated.
I hope i get a reply in terms of solving this problem.
vishalHi,
About iTextSharp component issue , I think this case is off-topic in here.
I suggest you consulting to compenent provider.
http://sourceforge.net/projects/itextsharp/
Regards,
Marvin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Unable to turn column headers bold in Word table using VB Script
I have created a table in Microsoft Word 2010 using VB Script (this is via the script engine that forms part of HP Quality Centre functionality). The table itself is OK, 2 columns with centred headers. However, I am unable to make the column
headers bold. I have spent hours searching the net and trying various options to no avail can somebody please help me.
Set objWord = CreateObject("Word.Application")
Set objDocument = objword.Documents.Open(Src_Dir & template_file
Const wdAlignParagraphCenter = 1'var to control justification of the table columns
Const NUMBER_OF_ROWS = 1 'number of rows in intial table
Const NUMBER_OF_COLUMNS = 2 'number of colums in the intitial table
'search for the "TAA_TABLE" bookmark embedded in the document template, this is where the table will be created
Set objRange=objDocument.Bookmarks("TAA_TABLE").Range
'create the table
objDocument.Tables.Add objRange, NUMBER_OF_ROWS, NUMBER_OF_COLUMNS
Set objTable = objDocument.Tables(2)
'populate column headers
objTable.Cell(1, 1).Range.Font.Bold = True
objTable.Cell(1, 1).Range.Text = "Sub Contractor"
objTable.Cell(1, 2).Range.text = "TAA Number"
'centre the column headers
objDocument.Tables(2).Rows(1).Select
Set objSelection = objWord.Selection
objSelection.ParagraphFormat.Alignment = wdAlignParagraphCenter
'format the table with plain grid lines
objTable.AutoFormat(16)
'set the column widths
objTable.Columns(1).Setwidth 230,0
objTable.Columns(2).Setwidth 230,0
Any help is graetfully appreciated, as this is driving me wild.
Cheers,Hi Citronax,
I haved noticed that you used objTable.AutoFormat to format the table. Based on my understanding, this fuction will applie a predefined look to a table.
After I move the code which bolder the text behind this line of code, it works well for me.
'format the table with plain grid lines
objTable.AutoFormat (16)
objTable.Cell(1, 1).Range.Font.Bold = True
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Repeated column headers in Crosstab report when exported to Excel
I have created a Cross tab report and wanted to export it in the format "Microsoft Excel(97-2003) (*.xls)", as the formatting of the report is lost in Excel Data Only format. But when I export the data the column headers are repeated in the Excel. Is there any solution to avoid repeated column headers without losing the formatting of layout?
I suppose one answer we should have before anything else;
Does the export work from the CR designer?
You may also want to see the following:
How to WYSIWYG SAP Crystal Reports Export to XLS
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
Maybe you are looking for
-
I moved all my music from c: drive(because it was full) to an external harddrive and now itunes can't find any of my music. Is there a way to get Itunes to find music on external drive without having to place all the music back onto the c: drive? Tha
-
4s not being recognized by iTunes, image capture, iPhoto or iMovie
Hi i have a iphone 4s and i need to back everything up, mainly my videos. i plugged it into my mac and it's not being recognised on iTunes, iMovie, iPhoto or image capture and i have the latest OS X on both phone and mac and have the latest version o
-
Using an external hard drive (HD), on a network, as a scratch disc?
I am weighing my options on creating a wireless network around an external HD. My macbook pro is getting full and I am going to do a spring cleaning and get everything in order. I pretty much know how I want to do it but I am wondering if I can use a
-
Download adobe flash player for iPad mini?
How can I download Flash player on iPad mini?
-
Hi All, We have settled cost to AuC in Mar' 08 and now we can reverse it in Mar'09, Is it possible? When I try to reverse it the following message is displayed, " Reversal not possible; last settlement was in period 012 2009. Message No. KD547. pls.