Spooling column headers correctly

Hi,
Im trying spooling a file in DB with below mentioned details.
SET SERVEROUTPUT OFF
set heading on
SET PAUSE OFF
SET FEED OFF
SET PAGES 0
SET LINE 5000
SET VERI OFF
SET TERM OFF
SET TERMOUT OFF
SET TIME OFF
SET UNDERLINE OFF
SET COLSEP ','
SET ECHO OFF
SET TRIM ON
SET TRIMOUT ON
SET TRIMSPOOL ON
set newpage none
spool ${OUTPUT_PATH}/${REPORT_NAME}/${REPORT}_${START_DATE}.csv
@${SCRIPT_PATH}/${REPORT_NAME}/my_query.sql
spool off
exit;
EOF
file .sql has 20 odd columns.
When file is spooled, it shows no columns headers at the top, why is it happening, I dont want to spool column headers separately.

but is it possible to change the format of multiple columns in one goNo, not possible. You will have to write 20 column format <column_names> A<N> for all the required columns. Here column name and column alias both are same i.e. column format command works same for column alias.
also tell me one thinng why "set heading on" does not work with "set pagesize 0"?The best thing might be to SET PAGESIZE 0, which turns off paging. Unfortunately, that turns off the automatic headers, too, so you'll have to supply your own header, manually, like this:
Frank @ Column headers in SQLPLUS query

Similar Messages

  • How to export data with column headers in sql server 2008 with bcp command?

    Hi all,
    I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
    am trying to import data with bcp command data has been copied but column names are not came.
    I am using the below query:-
    EXEC master..xp_cmdshell
    'BCP "SELECT  * FROM   [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
    Thanks,
    SAAD.

    Hi All,
    I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
    DECLARE @BCPCMD
    nvarchar(4000)
    DECLARE @BCPCMD1
    nvarchar(4000)
    DECLARE @BCPCMD2
    nvarchar(4000)
    DECLARE @SQLEXPRESS
    varchar(50)
    DECLARE @filepath
    nvarchar(150),@SQLServer
    varchar(50)
    SET @filepath
    = N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
    as varchar(4))
    +RIGHT('00'+CAST(MONTH(GETDATE())
    as varchar(2)),2)
    +RIGHT('00'+CAST(DAY(GETDATE())
    as varchar(2)),2)+'.log" '
    Set @SQLServer
    =(SELECT
    @@SERVERNAME)
    SELECT @BCPCMD1
    = '''BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT '
    SELECT @BCPCMD2
    = '-c -t , -T -S '
    + @SQLServer + 
    SET @BCPCMD
    = @BCPCMD1+ @filepath 
    + @BCPCMD2
    Print @BCPCMD
    -- Print out below
    'BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
    EXEC
    master..xp_cmdshell
    @BCPCMD
      ''BCP' is not recognized as an internal or external command,
    operable program or batch file.
    NULL
    if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
    EXEC
    master..xp_cmdshell
    'BCP "SELECT  * FROM  
    [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
    Thanks, SAAD.

  • 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?
    Cheers

    Class 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

  • Column headers and data are mismatched in Data tab of views after move col.

    Hi,
    Currently, I am using Windows XP, SQL Developer Version 1.2.1 Build Main 32.13.
    Java platform 1.5.0_06
    Oracle IDE 1.2.1.3213
    I'm having trouble with display of data from views in the "Data" tab of SQL Developer. If I move a column left or right of its original place, the data no longer line up with the proper column heading. The data are in the correct order, but the column headers are out of whack. Also, in the Single Record View, the data and column headers are mismatched.
    Refreshing the view, closing the view, closing and reopening SQL Developer do not "reset" the view so that the data and proper column headers are lined up. Even dropping and recreating the view does not force SQL Developer to use the proper data-column header match.
    Just to be clear, the data within the view is fine. It is the display of the data-column headers in the "Data" tab of SQL Developer (and the single record view) that is wrong. The mismatch seems to occur after a column is moved in the view.
    Is this a bug? I like the ability to move columns around within the display of the view. However, much more important that the column headers and data line up correctly.
    Thanks,
    Morgan

    Thanks much. I found the correct file, deleted it, and the column headers and data match up again.
    I found the correct file by searching the directory for one of the column names that occurs in the view (though I had to find both instances of "COLUMN_NAME" and "COLUMN NAME" (without the underscore)). Not sure why there were files with both versions.
    Do you know if there is any way to prevent those XXXXXXXXXTableSettings.xml files from writing all together (oracle.javatools.controls.nicetable.NiceTablePersistentSettings)? I looked through the SQL Developer preferences but nothing jumped out as being the setting to switch off.
    Should I be doing anything in particular to bring more attention to this potential bug so it might get fixed in a future release?
    Thanks again,
    Morgan

  • Column headers in forms are garbled

    Hi,
    I have one issue regarding folders in forms. User has set some custom folder on a form with following properties.
    Autoquery = Never,
    Check boxes checked : Open as Default, Public.
    User has set this folder as default folder. When user goes to particular window, he sees some column headers are garbled and not shown correctly.
    I checked user's .fmb file and compared with file on arcs log and did not find any differences between them.
    Can anybody suggest what might be the cause for this? What kind of set up may cause this?
    Thanks,
    Akshay

    Thanks much. I found the correct file, deleted it, and the column headers and data match up again.
    I found the correct file by searching the directory for one of the column names that occurs in the view (though I had to find both instances of "COLUMN_NAME" and "COLUMN NAME" (without the underscore)). Not sure why there were files with both versions.
    Do you know if there is any way to prevent those XXXXXXXXXTableSettings.xml files from writing all together (oracle.javatools.controls.nicetable.NiceTablePersistentSettings)? I looked through the SQL Developer preferences but nothing jumped out as being the setting to switch off.
    Should I be doing anything in particular to bring more attention to this potential bug so it might get fixed in a future release?
    Thanks again,
    Morgan

  • 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
    Janne

    Ian
    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

  • Cant see jtable column headers

    I have my jtable in a container and i am displaying that container in a jframe. I cant see the table column headers. I cant use a jscrollpane and need to make the table headers visible. I can see the table fine with all its information in it. When I do a System.out.println(TableModel.getColumnName(int)); i get the correct column header name so I know that the column headers are existing. I would appreciate any help that you can give

    the last answer did not help me out. I reposted this with more information, such as i am placing my table in a container and not in a scrollpane. I added the code below and it still did not work
    content.add(jt.getTableHeader(), BorderLayout.NORTH);
    content.add(jt, BorderLayout.CENTER);
    I can still only see the table. I pasted code below where I create my table and repaint it. I have it set up where my table is in a JPanel. I have is set up so that I can move it around and resize it with the mouse. This all works and I can see the table but there are no headers.
    public FigTable(DefaultTableModel inTableModel, LEditor inLEditor)
              super(50, 50, 350, 200);
              setLineColor(Color.blue);
              setFillColor(ColorMenu.kColorOfNoFill);
              fEditor = inLEditor;
              content = fEditor.getGEFPanel().getDrawingPanel();
              importTable(inTableModel);
              fEditor.init();
              fEditor.inval();
    public void importTable(DefaultTableModel inTableModel)
              jt = new JTable(inTableModel);
              tRows = jt.getRowCount();
              tColumns = jt.getColumnCount();
              content.add(jt, BorderLayout.CENTER);
              content.add(jt.getTableHeader(), BorderLayout.NORTH);
    public void paint(Graphics g)
              jt.setBounds(_x, y, w, _h);
              if (_h >= tRows && tRows != 0)
              jt.setRowHeight(_h / tRows);
              if (isSelected())
                   drawHandles(g);
              if (_filled && (getFillColor() != null))
                   jt.setBackground(getFillColor());
              if (getLineColor() != null)
                   jt.setGridColor(getLineColor());
                   jt.setBorder(BorderFactory.createLineBorder(getLineColor()));
         }

  • JTable column headers not showing up

    I have a JTable inside a JScrollPane which, in turn, is inside a JTabbedPane.
    I created a TableModel which extends AbstractTableModel as per the java Swing Tutorial examples.
    In that model is an Object[][] object for the data called rowData, and all the data displays in the table perfectly.
    I also have a String[] object called columnNames to define the column headers. ..the column names are coded directly into the object.
    i.e.: String[] columnNames = {"John", "Janet", "Jamie", "Jennifer"};But the column names don't display at all.....all I get in the column headers is 'A', 'B', 'C', etc.
    I need to know either
    1)how to set this up correctly in the first place or
    2)how I can reset the columns manually.
    I have tried adding the table 2 ways..as follows...but neither one gets the headers right:
    JScrollPane jScrollPane = new javax.swing.JScrollPane(getTable());or
    JScrollPane jScrollPane.setViewportView(getTable());Note: getTable()..is where the new javax.swing.JTabel(new TableModel())stuff is done.
    thx, ESW

    You mentioned the you columnNames array. I suggest you declare it as static and accessible from within your custom table modelprivate static final String[] COLUMN_NAMES = {"John", "Janet", "Jamie", "Jennifer"};Then you override/implement the following methods in your TableModel :public String getColumnName(int column) {
         return COLUMN_NAMES[column];
    public int getColumnCount() {
         return COLUMN_NAMES.length;
    }That should do the trick.

  • Column headers in SQLPLUS query

    Hi I am running a simple SQL query in SQLPLUS, and I want the column headers to appear just once at the top.
    If I set the 'SET PAGESIZE' to 50000 (which I thought was the max) it repeats the column headers evert 50000 lines.
    If I set 'SET PAGESIZE 50001', the column header appears every 14 lines
    Anyone help ?
    Thanks
    Mike
    Here is my SQLPLUS statement
    SET HEADING ON
    SET PAGESIZE 50001
    SET LINESIZE 80
    SET TERMOUT OFF
    SET VERIFY OFF
    SET FEEDBACK OFF
    SET TRIMS OFF
    SET COLSEP "|"
    SET CONCAT "."
    SET CONCAT "!"
    set newpage none
    set underline off
    SPOOL &1
    column Product format a4
    column Division format a3
    column Company format a4
    column Geography format a4
    column Customer format a12
    column Currency format a3
    column Year format a4
    column Account format a7
    column Period format a3
    SELECT /*+ index(GB,GL_BALANCES_N2) */
    'P'||GCC.SEGMENT8 Product,
    'D'||GCC.SEGMENT4 Division,
    'C'||GCC.SEGMENT1 Company,
    'G'||GCC.SEGMENT5 Geography,
    'G'||GCC.SEGMENT7 Customer,
    '&2' Currency,
    'FY'||substr(GB.PERIOD_NAME,5,2) Year,
    'A'||GCC.SEGMENT2 Account,
    substr(GB.PERIOD_NAME, 1, 3) Period,
    trim(to_char(SUM((NVL(GB.PERIOD_NET_DR,0)-NVL(GB.PERIOD_NET_CR,0))*DECODE(SUBSTR(GCC.SEGMENT2,1,1),'4',(-1),1)),'999999999990.99')) VALUE
    FROM
    GL.GL_BALANCES GB,
    GL.GL_CODE_COMBINATIONS GCC
    WHERE GCC.CHART_OF_ACCOUNTS_ID=101
    AND GB.CODE_COMBINATION_ID=GCC.CODE_COMBINATION_ID
    AND GB.SET_OF_BOOKS_ID = &3
    AND GB.ACTUAL_FLAG = 'A'
    AND GB.CURRENCY_CODE = '&2'
    AND GCC.SEGMENT2 BETWEEN '400000' AND '999999'
    AND NOT (GCC.SEGMENT2 BETWEEN '899501' AND '899506')
    AND GCC.SEGMENT2 != '899999'
    AND GB.PERIOD_NAME in &4
    GROUP BY
    'P'||GCC.SEGMENT8,
    'D'||GCC.SEGMENT4,
    'C'||GCC.SEGMENT1,
    'G'||GCC.SEGMENT5,
    'G'||GCC.SEGMENT7,
    '&2',
    'FY'||substr(GB.PERIOD_NAME,5,2),
    'A'||GCC.SEGMENT2,
    substr(GB.PERIOD_NAME, 1, 3)
    HAVING SUM(NVL(GB.PERIOD_NET_DR,0)) - SUM(NVL(GB.PERIOD_NET_CR,0)) <> 0
    ORDER BY
    'P'||GCC.SEGMENT8,
    'D'||GCC.SEGMENT4,
    'C'||GCC.SEGMENT1,
    'G'||GCC.SEGMENT5,
    'G'||GCC.SEGMENT7,
    '&2',
    'FY'||substr(GB.PERIOD_NAME,5,2),
    'A'||GCC.SEGMENT2,
    substr(GB.PERIOD_NAME, 1, 3);
    spool off
    exit

    Hi,
    Ranzalman wrote:
    Hi I am running a simple SQL query in SQLPLUS, and I want the column headers to appear just once at the top.
    If I set the 'SET PAGESIZE' to 50000 (which I thought was the max) it repeats the column headers evert 50000 lines.
    If I set 'SET PAGESIZE 50001', the column header appears every 14 linesApparantly, 50,000 lines is the max. If you try to set PEGESIZE higher than that, you get the default, which is 14.
    The best thing might be to SET PAGESIZE 0, which turns off paging. Unfortunately, that turns off the automatic headers, too, so you'll have to supply your own header, manually, like this:
    SPOOL  &1
    SET   PAGESIZE    0
    PROMPT  PROD|DIV|COMP|GEOG|CUSTOMER    |CUR|YEAR|ACCOUNT|PER|VALUE
    SELECT /*+ index(GB,GL_BALANCES_N2) */
    ...

  • Form results does not show column headers

    I created a form and when I enter info and then view the results, the results page does not show column headers.  How do I correct this?

    I just found out that the engineered version (10g) is also quite strange:
    http://public.ceving.de/2012050900/postaladdress_10g.png
    It shows the values in the columns for the types.
    This looks very buggy.
    Is it not recommended to create views with the data modeler?
    Edited by: 931739 on 09.05.2012 06:38

  • Resize column width for JTable without column headers?

    Hi,
    I find that for me to resize columns of a JTable by using
    mouse dragging, I MUST have column headers and then drag
    column headers to resize them. Is my understanding correct?
    Actually, I need to have a table without header columns.
    How can I use mouse to resize column width by dragging?
    The background for this request is that I am putting a
    complex table as another table's column header and I hope to
    be able to resizing the complex table by mouse dragging.
    Thanks very much,
    David

    Hi,
    I think you have mistake there. Try
    <style type="text/css">
    table.apexir_WORKSHEET_DATA td {
    white-space:nowrap !important;
    td[headers="DESCR"] {
    width:300px !important;
    max-width:300px !important;
    #apexir_DESCR {
    width:10px;
    max-width:300px !important;
    </style>And you can try add
    table.apexir_WORKSHEET_DATA {
    width: 100% !important;
    table-layout: fixed !important;
    }Regards,
    Jari
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • Hello I have the Latest version of Adobe Lightroom 5 to date (8/26/14) however just recently when I open the develop tab I'm missing two options on the right side column "Lens correction" and "Effects"  I do not know I've hit some setting to remove those

    Hello I have the Latest version of Adobe Lightroom 5 to date (8/26/14) however just recently when I open the develop tab I'm missing two options on the right side column "Lens correction" and "Effects"  I do not know I've hit some setting to remove those options or if this latest version deleted those options?  Any help would be greatly appreciated and please excuse my ignorance :/

    Right click next to one of the other headers and you will get a pop-up to enable the missing ones.

  • Populate a cell with column headers, seperated by a comma, if any of the columns rows contain text

    I have a table, much like the one below:-
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    S
    John
    Yes
    Paul 
    No
    Dave
    Jay
    No
    Matt
    Yes
    Yes
    Karl
    Lois
    Jane
    Maybe
    Anna
    Barry
    No
    Yes
    Maybe
    I want to populate a cell on another sheet with the column headers if the row contains text. For examplein the case of 'Matt', the value I want returned is 'E, R' becuase there is text in the 'Matt' Row in columns E and R
    Anyone have any ideas?
    Thanks,
    Karl

    Hi Hans,
    Thanks for that. It works to an extent in that it returns the correct Column, but I actually want it to return the Column heading. It's my fault for not making it clear, I should have used different names for the column headings rather than just A to S......apologies.
    Other than that, it does work, but if you have any suggestions on how to get the actual column heading, that would be great.
    For example:-
    Mon
    Tue
    Wed
    Thu
    Fri
    Sat
    Sun
    Mon
    Tue
    Wed
    Thu
    Fri
    Sat
    Sun
    Mon
    Tue
    Wed
    Thu
    Fri
    John
    Paul
    Yes
    Dave
    Jay
    Yes
    No
    Matt
    Karl
    Yes
    Lois
    Yes
    Jane
    Anna
    Barry

  • How to implement fixed column headers

    Hi Gurus,
    I got a requirement to show a fixed column header in a sql reports. That means no matter how many rows the report returns, when scrolling down, the column headers are fixed and appear on the top.
    Anybody has any comments on this? If I'm not making sense, let me know and I can explain further.
    Thanks in advance.

    Hello Carl,
    Thanks for responding!
    I just realized that I did not include my name in my prior post, its Kyle, sorry about that. I also do not necessarily have an example code to show you, let me explain:
    I am very much a newbie to the HTML environment. Amazingly, I was able to apply a code that would facilitate a scroll bar in my report. This code was applied to the template called Reports Region in the section entitled Definition, it basically looks like this:
    <style>
    .RegionScroll
    width:950px;
    height:225px;
    overflow:auto;
    border:solid 0px;
    </style>
    My next feat was to figure out how to fix the column headings, here is were….. well basically I guessed. First; I looked at the website describing how to implement this in three steps, to be functional in both IE and Fire Fox. I was not sure exactly were to apply the script provided, so I made a logical guess and dropped it in to the same area as my previous code. When I went to view the page the code line:
    onload="MakeStaticHeader('TableId','150px')"
    showed up at the top of the page (no Java script error presented itself). I concluded that I either have the wrong programming syntax, its in the wrong template and or template section. To complicate matters I have no idea of how to identify the correct TableId. I did look to view the HTML source code of the page, but found several candidates with the prefix "ID=".
    Quite honestly, without a good formal understanding of HTML or CSS programming techniques, I may be biting more off than I can chew. If this is the case then would you be kind enough to point me in some direction that might help me get over this hurdle.
    Thanks again for the response.
    Kyle

  • How to make column headers in table in PDF report appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp

    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.
    vishal

    Hi,
    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.

Maybe you are looking for

  • LOVS in JSP - No Combo

    Is it possible to create a LOV opening a "search window" in wich the user can search and select the value he wants and have back the value in the main form ? Any suggestion will be appreciated. TIA Tullio

  • Account determination Error while posting to FI

    Dear gurus, At the time of billing there is an error "error in account determination table T030K" the posting is not happening to FI. I am using a manual condition for excise. I have checked in the OB40 settings. G/L account is assigned to that parti

  • Using Calende in a JSP

    Hi i need to use a calender in a JSP page instead of using text box which need more validations thanks alot

  • Problem in print after fullscreen

    Hi All, I got a printJob object in Flash CS5. When I execute the print function, the flashplayer exits the fullscreen mode when the printing window appears. This problem only occurs in windows. Does anybody know how to solve this problem?

  • Msn iqy return no data

    My IQY files stopped working yesterday.  Has something changed or are there some web issues? Dean E. McKaig Any progress on the fix here?  MS lack of concern here really SUCKS!!!