Prepopulating Interactive Form with XML Data using VBA

I have an excel spreadsheet with data on it.  I need to click on a button that will cause an Interactive PDF form to open and be populated with data from the spreadsheet.  To do this I want to use an XML data file.  I know how to create the file, but how do I cause the PDF to open in Adobe Reader with the XML data file using VBA?  The link needs to be a soft link, in that the name of the XML file could change.
Many thanks for answers.

            strXFDFFile = "c:\temp\" & strFileName & "tmp.xfdf"
            'Open the PDF file
             appPDFInit = True
             Status "Processing " & strFileName
             DoEvents
             ' Create PDF File, if any
             If strXFDFFile <> "" Then
                 Dim fldValue As String
                 Open strXFDFFile For Output As #1
                 Print #1, "<?xml version=""1.0"" encoding=""UTF-8""?>"
                 Print #1, "<xfdf xmlns=""http://ns.adobe.com/xfdf/"" xml:space=""preserve"">"
                 Print #1, "<f href=""" & strFilePath & strFileName & """/>"
                 Print #1, "<fields>"
                 For Each fdField In rsData.Fields
                 If IsNull(fdField.Value) Then
                     fldValue = ""
                 Else
                     fldValue = fdField.Value
                     fldValue = XMLit(fldValue)
                 End If
                 If InStr(1, fdField.Name, "ID") > 0 Then
                     fldValue = Format(fldValue, "##########")
                 End If
                 If InStr(1, fdField.Name, "ZIP") > 0 Then
                     fldValue = Format(fldValue, "#####")
                 End If
                 If InStr(1, fdField.Name, "Rate") > 0 Then
                     fldValue = Format(fldValue, "#0.00#")
                 End If
            '        Write #1, fdField.Name,
                 Print #1, "<field name=""" & fdField.Name & """>"
                 Print #1, "<value>" & fldValue & "</value>"
                 Print #1, "</field>"
                 Next
                 Print #1, "</fields>"
                 Print #1, "</xfdf>"
             Close #1
            End If
            Dim x As Long
            For x = 1 To 1000000: Next x
            LaunchPDF.LaunchFile strXFDFFile, 0, 2
Make sure you reference the Adobe Acrobat Browser Control Library under Tools | References
It will merge to Adobe Reader.  Note that I have made the strXFDFFile variable unique by including the name of the PDF file.  This assures that you can merge to more than one PDF at a time (this is taken from a loop for multiple PDF files).  Note that the XFDF file must include the path and the PDF file name in order to open the correct PDF for merging.
I don't have time to explain the code, but if you have any questions let me know.
Daniel H. Smith
Smith Enterpises LLC

Similar Messages

  • Populating a PDF form with XML data

    Hi folks,
    I would like to create some pdf form template, populate it with xml data and output from it a pdf file.
    Can I do such thing using LiveCycle?
    Yair

    With the recent release Adobe changed the name to Adobe Digitial Enterprise Platform (ADEP)..
    http://www.adobe.com/solutions/customer-experience/enterprise-platform.html
    ADEP server software comes with lot of services to help with many solutions for the enterprises, so it would be better to call the Adobe Sales team and discuss your needs and they will be best people to suggest what suits your company requirements.
    Thanks
    Srini

  • Generate Adobe Interactive Form with XML Schema-Based Interface

    Hi,
    I need to generate a adobe Interactive but with XML Schema-Based Interface, i have one example but with ABAP Dictionary-Based Interface.
    CALL FUNCTION 'FP_JOB_OPEN'
      CHANGING
        ie_outputparams       = fp_outputparams
    * EXCEPTIONS
    *   CANCEL                = 1
    *   USAGE_ERROR           = 2
    *   SYSTEM_ERROR          = 3
    *   INTERNAL_ERROR        = 4
    *   OTHERS                = 5
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
      EXPORTING
        i_name     = 'ZMMDM_CL'
      IMPORTING
        e_funcname = fm_name.
    But when i call the next function for print i need the docxml parameter and i don't know how to get it
    fm_name
    CALL FUNCTION fm_name
      EXPORTING
       /1BCDWB/DOCPARAMS        = fp_docparams
    *    /1bcdwb/docxml           =
    * IMPORTING
    *   /1BCDWB/FORMOUTPUT       =
    * EXCEPTIONS
    *   USAGE_ERROR              = 1
    *   SYSTEM_ERROR             = 2
    *   INTERNAL_ERROR           = 3
    *   OTHERS                   = 4

    1) this questions was asked many times before, you didn´t search for a second
    2) I am not aware of any standard solution
    3) custom solution: use XSLT transformation ID to get XML from the filled DDIC structure and use string operations to add the header and footer to create a valid XML.
    Regards Otto

  • PDF form with XML data connection comes up blank at run time

    Hello All,
    I am a newbie to ADOBE Livecycle 9, but am very proficient in C#.  I would like to request for your guidance on the following issue.
    We have a desktop application in C#, WPF, Sqlserver. The requirement is to launch a Livecycle form from the application for the user to read/edit/save data
    I have done this much so far -
    Downloaded trial version of Livecycle 9
    Developed a interactive PDf form
    Created an XML based data connection. Generated fields on the form using the fields from this connection.
    Set the .XML file as preview source for the form
    the controls on the form are boumd to the xml data source
    In design mode, the form works fine, it displays my data correctly
    I have created a WPF form with a button. On click of this button, I call the Process.Start(pdf-file-path). My pdf is launched properly
    I have added a combo box to my WPF form. I select a parameter from this, then call a stored procedure which returns me a datatable depending on parameter passed
    Using the returned datatable, I have used the datatable.writexml and datatable.writexmlschema to create my XML and XSD files. as mentioned above, this xsd is used to create the data connection for the PDF and the XML for the preview source
    This is what I want to do -
    Launch the PDF from my WPF form, pre-populated with the newly created XML data from my WPF form.
    So basically, as the user changes the selection criteria from the combo box, the XML file data will change and the PDF file will be launched each time with new data.
    The XSD format will always be constant
    Problem -
    My XML and XSD get created properly, my PDF launches, but it is empty
    If I change my selection criteria and run the WPF application, and then open the PDF in design mode, it asks me whether it should refresh the XML source. This means that the PDF form is connecting correctly to the XML source
    So why then, does the form come up empty at run time?
    What link am I missing?
    I have found some sites that help using Web applications, but nothing for desktop applications. It would be fantastic if you could point me to some help for developing Livecycle forms with C# / SQLServer
    Your help in this case will be highly appreciated.
    Thanks and Regards

    Oops, something happended with the above post. I will try again... I have tried your suggestion but I still get the same garbled XML (with data repeated and some values "cut in half".<br /><br />Here is what I get after decode-service and extract-to-XML-service. This is just the first barcode, the others are similar, sorry for the poor formatting, but I get a CDATA tage infront of the "istensen" value.<br />                                                              <br />CDATA:istensen</fld_ForMellemEfterNavn<br />><fld_VejNRpostByEnLinie<br />>Superroad 99, 1330 Supertown</fld_VejNRpostByEnLinie<br />><fld_PrivatTelefonnummer<br />>20724283</fld_PrivatTelefonnummer<br />></sub_Person<br />></sub_PktA<br />><fld_BlanketNr<br />>kb0371ff</fld_BlanketNr<br />><fld_BarcodeCount<br />/></form1<br />>/sub_Adresse<br />><sub_Person<br />><fld_ForMellemEfterNavn>Kim Christensen</fld_ForMellemEfterNavn<br />><fld_VejNRpostByEnLinie<br />> Superroad 99, 1330 Supertown </fld_VejNRpostByEnLinie<br />><fld_PrivatTelefonnummer<br />>20724283</fld_PrivatTelefonnummer<br />></sub_Person<br />></sub_PktA<br />><fld_BlanketNr<br />>kb0371ff</fld_BlanketNr<br />><fld_BarcodeCount<br />/></form1<br /><br />Obviously this is not a legal xml-string, so I can do nothing about it.<br /><br />I have tried using a custom .NET component (ClearImage) for reading the same form (with the barcode) I get the correct data out from the barcodes. So I guess something is wrong with the decode-service in Barcoded Forms ES when I use compressed XML. But I can conclude since the ClearImage component can read the barcodes that they are compressed correctly.<br /><br />Can you help me with getting further with this problem?<br /><br />Sincerely<br />Kim

  • Barcoded form with XML-data

    Hi all,
    In our solution we have some barcodes on a form (7 barcodes on the one that I am using), they contain compressed XML data (I know that this uses much space in the barcode - anyway it should work regardless of this).
    What the interesting thing is what is returned from the "decode-service" in WB.
    When I run a scanned form through the process I have created I get "garbled" xml in my XML-doc that is returned from the decode-service.
    If I use a handheld scanner (with a customly created program that handles the compression) I get the correct data from the barcode.
    If I do not use compression in the barcode I get the correct XML data from the barcode (with the decode-service). This is weird to me... What is going on???
    Some time ago I posted this issue (http://www.adobeforums.com/webx?128@@.3c058293) but never really caught up with a solution.
    Can you help me with this?
    Sincerely
    Kim

    Oops, something happended with the above post. I will try again... I have tried your suggestion but I still get the same garbled XML (with data repeated and some values "cut in half".<br /><br />Here is what I get after decode-service and extract-to-XML-service. This is just the first barcode, the others are similar, sorry for the poor formatting, but I get a CDATA tage infront of the "istensen" value.<br />                                                              <br />CDATA:istensen</fld_ForMellemEfterNavn<br />><fld_VejNRpostByEnLinie<br />>Superroad 99, 1330 Supertown</fld_VejNRpostByEnLinie<br />><fld_PrivatTelefonnummer<br />>20724283</fld_PrivatTelefonnummer<br />></sub_Person<br />></sub_PktA<br />><fld_BlanketNr<br />>kb0371ff</fld_BlanketNr<br />><fld_BarcodeCount<br />/></form1<br />>/sub_Adresse<br />><sub_Person<br />><fld_ForMellemEfterNavn>Kim Christensen</fld_ForMellemEfterNavn<br />><fld_VejNRpostByEnLinie<br />> Superroad 99, 1330 Supertown </fld_VejNRpostByEnLinie<br />><fld_PrivatTelefonnummer<br />>20724283</fld_PrivatTelefonnummer<br />></sub_Person<br />></sub_PktA<br />><fld_BlanketNr<br />>kb0371ff</fld_BlanketNr<br />><fld_BarcodeCount<br />/></form1<br /><br />Obviously this is not a legal xml-string, so I can do nothing about it.<br /><br />I have tried using a custom .NET component (ClearImage) for reading the same form (with the barcode) I get the correct data out from the barcodes. So I guess something is wrong with the decode-service in Barcoded Forms ES when I use compressed XML. But I can conclude since the ClearImage component can read the barcodes that they are compressed correctly.<br /><br />Can you help me with getting further with this problem?<br /><br />Sincerely<br />Kim

  • Populate PDF form with XML data

    Although a seemingly simple task, this question has occupied way too much of my time the last week and I am asking the following out of sheer desperation and frustration.
    I have a pdf form created with Designer 7.0. I have a separate XML data file to populate the form with. I can test using the preview in Designer and everything looks great. Now, all I want to do is deploy this pdf to a standard web server (IIS, Windows) such that any visitor to the site (using Reader) is able to open it/view it/print it, with the data there. That's it.
    This was easily accomplished using Acrobat 6 by creating an ASP page that output an FDF file which referenced the PDF. Not so with the latest version.
    I have downloaded three separate several hundred page documents that do not explain how to accomplish this task simply. So to summarize:
    1. Does this task *require* a separate piece of software (Document Server) that was not required before?
    2. If Document Server is not required, what are the steps to publish the pdf file and reference the data file?
    Please help, extraordinarily frustrated :-(.

    Ravinder, were you actually able to get your PDF Document (Form) to load with data?  I have not been able to get my .NET page to populate my PDF document - the PDF loads in my Browser but has no data.  If you can post sample code that you were able to get to work, it would be appreciated, or if you notice something wrong with my code below, please let me know.<br /><br />Also, when my PDF document loads in my browser, I am prompted to "Open or Save" my .xdp file and if I click "Open", my PDF Form loads, but the fields are not populated.  How do I stop this prompt from loading?  I don't want the user(s) to be able to see this.<br /><br />My .NET page and XML file are listed below:<br />------------------------- .NET -----------------------------------<br />Imports System.Text<br />Imports System.IO<br /><br />Public Class WebForm1<br />    Inherits System.Web.UI.Page<br /><br />#Region " Web Form Designer Generated Code "<br /><br />    'This call is required by the Web Form Designer.<br />    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()<br /><br />    End Sub<br /><br />    'NOTE: The following placeholder declaration is required by the Web Form Designer.<br />    'Do not delete or move it.<br />    Private designerPlaceholderDeclaration As System.Object<br /><br />    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init<br />        'CODEGEN: This method call is required by the Web Form Designer<br />        'Do not modify it using the code editor.<br />        InitializeComponent()<br />    End Sub<br /><br />#End Region<br /><br />    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />        'Put user code to initialize the page here<br /><br />        Dim responseString As New StringBuilder<br />        Dim sr As StreamReader<br />        Dim xmldata As String<br /><br />        Response.ContentType = "application/vnd.adobe.xdp+xml"<br />        responseString.Append("<?xml version='1.0' encoding='UTF-8'?>")<br />        responseString.Append("<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>")<br />        responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>")<br />        responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>")<br />        responseString.Append("<xfa:data xfa:dataNode='dataGroup'>")<br />        sr = File.OpenText("c:\\inetpub\\wwwroot\\PDFFiller\\TestForm_data.xml")<br />        xmldata = sr.ReadToEnd()<br />        sr.Close()<br />        responseString.Append(xmldata)<br /><br />        'responseString.Append("<form1>")<br />        'responseString.Append("<txtFirstName>Homer</txtFirstName>")<br />        'responseString.Append("<txtLastName>Simpson</txtLastName>")<br />        'responseString.Append("</form1>")<br /><br />        responseString.Append("</xfa:data>")<br />        responseString.Append("</xfa:datasets>")<br />        responseString.Append("<pdf href='http://localhost/PDFFiller/TestForm.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />")<br />        responseString.Append("<xfdf xmlns='http://ns.adobe.com/xfdf/' xml:space='preserve'>")<br />        responseString.Append("<annots/>")<br />        responseString.Append("</xfdf>")<br />        responseString.Append("</xdp:xdp>")<br /><br />        Response.Write(responseString)<br />        Response.Flush()<br />        Response.End()<br /><br />    End Sub<br /><br />End Class<br /><br />----------------------End .NET -----------------------------------<br /><br />--------- XML (TestForm_data.xml) --------------------------------<br /><form1><txtFirstName>Homer</txtFirstName><txtLastName>Simpson</txtLastName></form1><br />----------------------End XML -----------------------------------

  • Filling PDF Form with XML data file

    Hello everybody.
    I need help.
    I created a form with LiveCycle Designer. I filled it and generated a XML data files. Now, I would like to fill the same blank PDF form with this XML data file.
    I know that I can do it with Adobe 8.0 but I must do it in an C# / .NET application that I have to create.
    (Forms I'm creating are not for me, I create the forms. Client uses them form but he don't have Adobe Acrobat 8.0, so he can't realise the automatic PDF filling with Adobe Acrobat 8.0)
    So I am looking for help with ".NET" "COM" or other library to help me to do it. If someone has other idea just give it.
    Thanks for your reply
    Jean Pierre (sorry for my bad English)

    Hello Mike
    Thank's for your reply. I used XPAAJ and it works very well but my company his develloping software with C# langage.
    I tried to convert XPPAJ to C#, I did it with the Java Langage Conversion Assistant but "Adobe Library" included in jar files cannot be translated to C#/.NET library. So, I can't use it.
    I found some C#/.NET API on the NET but they are very expensive and my company don't want to pay. They want me to create my own solution with library given by Adobe when you buy Adobe 8. So I am looking for this library.
    Is there an Adobe LiveCycle Designer SDK to help me.
    Thank you in advance for your reply
    Jean Pierre (student developing with LiveCycle Designer)

  • Attach the whole form with XML data when Emailed

    Hi all
    I am new to Adobe Livecycle product. I have been using IBM workplace forms and now want to migrate to Adobe Forms. I want the whole completed PDF form to be attached along with the xml data in it when someone clicks the email button and email is sent. Currently when I am able to attach only the data part to the email.
    Please advice on this...
    Thanks
    Ullas

    The default email submit button is set up to send just the data/ If you drop a button object onto the form, set it to be a submit button, then use the mailto protocol to setup who you want to send it to. One of the button parameters allows you to choose what you want to submit. in your case choose PDF.

  • Delete Power Query queries' custom XML data using VBA

    I have Power Query queries in an Excel 2010 file and would like to delete these queries using VBA. so far I can achieve that manually with the following steps:
    unload Power Query addin
    run Document Inspector and click to delete Custom XML data
    The Macro recorder record the following code for step 2.
    Sub Makro1()
    ' Makro1 Makro
    ActiveWorkbook.RemoveDocumentInformation (xlRDIPrinterPath)
    ActiveWorkbook.RemoveDocumentInformation (xlRDIDocumentProperties)
    ActiveWorkbook.RemoveDocumentInformation (xlRDIInactiveDataConnections)
    End Sub
    However, using this macro I do not achieve the same result (=PQ query code gone from the workbook).
    Any ideas on how to achieve the PQ query codes to be removed using VBA?

    On some cases Macro Recording is not complete, and misses to record the full set of VBA to automate the actions you record. This is probably such a case.
    We are looking into future ways to allow you automate Power Query cleanup.
    For the time being, please see if the
    Document Inspector interface can clean the custom XML data (which holds the Power Query data structures).
    thx, Gil.

  • Repeating sub-form with XML data from aspx page

    Hi,<br />I am doing a POC where I have a repeating subform in my Life cycle form.<br /><br />Now I want it to show data based on the XML that I have written, sample is below.<br /><br />My problem is that the sub-form does not repeat. Can you help me with this problem or if you can let me know your experience if this is possible that would be great.<br /><br />Thanks,<br />Manish<br /><br />strXML = "<?xml version='1.0' encoding='UTF-8'?>"; <br />        strXML = strXML + "<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>"; <br />        strXML = strXML + "<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>"; <br />        strXML = strXML + "<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>"; <br />        strXML = strXML + "<xfa:data>"; <br />        strXML = strXML + "<RepeatForm>"; <br />        strXML = strXML + "<emp>name</emp>"; <br />        strXML = strXML + "</RepeatForm>"; <br />        strXML = strXML + "<RepeatForm>"; <br />        strXML = strXML + "<emp>name1</emp>"; <br />        strXML = strXML + "</RepeatForm>"; <br />        strXML = strXML + "</xfa:data>"; <br />        strXML = strXML + "</xfa:datasets>"; <br />        strXML = strXML + "<pdf href='http://servername/projectname/filename.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />"; <br /><br />strXML = strXML + "</xdp:xdp>";

    hi this is a sample i created for this check out this link
    http://anilmathewm.blogspot.com/2010/07/how-to-post-data-from-flash-to-php-or.html

  • Merge LiveCycle Form with XML using JAVA

    Hello.
    I am trying to find out how to merge non-interactive form with XML (using JAVA) so the users can see the final output form with the data filled in.
    What are my choices..?
    So far, I have created the interactive forms as template using LiveCycle 8 and wrote ASP.NET code to extract data and store it in SQL database when the user fill out and submit the form.
    It works great but another agency wants to access the form as well.
    They told us that they will create the XML themselves from the database, so they just need to combine the form with XML to display it (non-interactive form).
    They want to use JAVA but I am not sure how to do that...
    Any suggestion?

    Assuming that you start with XML in an org.w3c.dom.Document that stores the XML data. Before you can merge it into a form, you have to convert it to a com.adobe.idp.Document object. TO convert a org.w3c.dom.Document to a com.adobe.idp.Document object -- use the following Java code:
    private Document convertDataSource(org.w3c.dom.Document myDOM)
    byte[] mybytes = null;
    try
    //Create a Java Transformer object
    TransformerFactory transFact = TransformerFactory.newInstance();
    Transformer transForm = transFact.newTransformer();
    //Create a Java ByteArrayOutputStream object
    ByteArrayOutputStream myOutStream = new ByteArrayOutputStream();
    //Create a Java Source object
    javax.xml.transform.dom.DOMSource myInput = new DOMSource(myDOM);
    //Create a Java Result object
    javax.xml.transform.stream.StreamResult myOutput = new StreamResult(myOutStream);
    //Populate the Java ByteArrayOutputStream object
    transForm.transform(myInput,myOutput);
    // Get the size of the ByteArrayOutputStream buffer
    int myByteSize = myOutStream.size();
    //Allocate myByteSize to the byte array
    mybytes = new byte[myByteSize];
    //Copy the content to the byte array
    mybytes = myOutStream.toByteArray();
    catch (Exception e) {
    System.out.println("The following exception occurred: "+e.getMessage());
    //Create a com.adobe.idp.Document object and copy the
    //contents of the byte array
    Document myDocument = new Document(mybytes);
    return myDocument;
    THen you can merge myDocument into the Form using renderPDFFOrm:
    FormsResult formOut = formsClient.renderPDFForm(
    formName, //formQuery
    myDocument, //inDataDoc
    pdfFormRenderSpec, //PDFFormRenderSpec
    uriValues, //urlSpec
    fileAttachments //attachments
    Hope this helps!

  • Create offline interactive forms using webdynpro java with XML data source

    Hi Gurus,
    I am having a scenario like below:
    Sales guy request for order list online from portal- Sytem receives the request and creat XML file- from xml file need to create a Offline interactive form-Sales guy fills it offline at customer site- uploads in portal -on submit xml has to be generated with captured data at customer site-Process to  ECC.
    So my questions are:
    How to create the offline interactive form  from XML?
    Once filled offline interactive form uploaded into portal how to create XML again from pdf ?
    Please give some idea on this as this is my first Offline interactive form using XML datasource.
    Thanks
    Ravi
    Edited by: Ravi Sunkara on Jul 27, 2010 5:25 PM

    Hi Otto,
    Sorry for replying lately. First of all  I did not get your suggestions as your are editing the same posting.
    Secondly we will be using WDJ. Actually in between SAP Portal and ECC we are having adobe LCES so we need to create Interactive form using XML only. Once it is filled again the form will be submitted to another application which is running on FLEX, which will process the order.
    if you can give me your personal id i can send you the detailed process
    Thanks
    Ravi

  • XML generation with SAP data using XML schema - Reg

    Hello experts,
      My requirement is , SAP( ztable data )  data has to be transferred to third party software folder.Third party using XML so they requires output from SAP in XML format.
    For that third party software guys told me that they will give their own XML schema to me.I have to generate XML file with SAP data using their XML schema.
    Generating XML file with their Schema should be underlined.
    I studied that call transformation statement helps for this.
    Even then i don't have clear idea about this topic.
    Please brief me about how to use their XML schema to generate XML with my own sap data.
    Thanks in advance experts.
    Kumar

    please  try this  same program    and see  it ....
    *& Report  z_xit_xml_check
      REPORT  z_xit_xml_check.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF t_xml_line,
              data(256) TYPE x,
            END OF t_xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_parser          TYPE REF TO if_ixml_parser,
            l_istream         TYPE REF TO if_ixml_istream,
            l_document        TYPE REF TO if_ixml_document,
            l_node            TYPE REF TO if_ixml_node,
            l_xmldata         TYPE string.
      DATA: l_elem            TYPE REF TO if_ixml_element,
            l_root_node       TYPE REF TO if_ixml_node,
            l_next_node       TYPE REF TO if_ixml_node,
            l_name            TYPE string,
            l_iterator        TYPE REF TO if_ixml_node_iterator.
      DATA: l_xml_table       TYPE TABLE OF t_xml_line,
            l_xml_line        TYPE t_xml_line,
            l_xml_table_size  TYPE i.
      DATA: l_filename        TYPE string.
      PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:temporders_dtd.xml'.
    * Validation of XML file: Only DTD included in xml document is supported
      PARAMETERS: pa_val  TYPE char1 AS CHECKBOX.
      START-OF-SELECTION.
    *   Creating the main iXML factory
        l_ixml = cl_ixml=>create( ).
    *   Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
        PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
    *   wrap the table containing the file into a stream
        l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
                                                        size  = l_xml_table_size ).
    *   Creating a document
        l_document = l_ixml->create_document( ).
    *   Create a Parser
        l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
    *   Validate a document
        IF pa_val EQ 'X'.
          l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
        ENDIF.
    *   Parse the stream
        IF l_parser->parse( ) NE 0.
          IF l_parser->num_errors( ) NE 0.
            DATA: parseerror TYPE REF TO if_ixml_parse_error,
                  str        TYPE string,
                  i          TYPE i,
                  count      TYPE i,
                  index      TYPE i.
            count = l_parser->num_errors( ).
            WRITE: count, ' parse errors have occured:'.
            index = 0.
            WHILE index < count.
              parseerror = l_parser->get_error( index = index ).
              i = parseerror->get_line( ).
              WRITE: 'line: ', i.
              i = parseerror->get_column( ).
              WRITE: 'column: ', i.
              str = parseerror->get_reason( ).
              WRITE: str.
              index = index + 1.
            ENDWHILE.
          ENDIF.
        ENDIF.
    *   Process the document
        IF l_parser->is_dom_generating( ) EQ 'X'.
          PERFORM process_dom USING l_document.
        ENDIF.
    *&      Form  get_xml_table
      FORM get_xml_table CHANGING l_xml_table_size TYPE i
                                  l_xml_table      TYPE STANDARD TABLE.
    *   Local variable declaration
        DATA: l_len      TYPE i,
              l_len2     TYPE i,
              l_tab      TYPE tsfixml,
              l_content  TYPE string,
              l_str1     TYPE string,
              c_conv     TYPE REF TO cl_abap_conv_in_ce,
              l_itab     TYPE TABLE OF string.
        l_filename = pa_file.
    *   upload a file from the client's workstation
        CALL METHOD cl_gui_frontend_services=>gui_upload
          EXPORTING
            filename   = l_filename
            filetype   = 'BIN'
          IMPORTING
            filelength = l_xml_table_size
          CHANGING
            data_tab   = l_xml_table
          EXCEPTIONS
            OTHERS     = 19.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    *   Writing the XML document to the screen
        CLEAR l_str1.
        LOOP AT l_xml_table INTO l_xml_line.
          c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement = space  ).
          c_conv->read( IMPORTING data = l_content len = l_len ).
          CONCATENATE l_str1 l_content INTO l_str1.
        ENDLOOP.
        l_str1 = l_str1+0(l_xml_table_size).
        SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
        WRITE: /.
        WRITE: /' XML File'.
        WRITE: /.
        LOOP AT l_itab INTO l_str1.
          REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
            l_str1 WITH space.
          WRITE: / l_str1.
        ENDLOOP.
        WRITE: /.
      ENDFORM.                    "get_xml_table
    *&      Form  process_dom
      FORM process_dom USING document TYPE REF TO if_ixml_document.
        DATA: node      TYPE REF TO if_ixml_node,
              iterator  TYPE REF TO if_ixml_node_iterator,
              nodemap   TYPE REF TO if_ixml_named_node_map,
              attr      TYPE REF TO if_ixml_node,
              name      TYPE string,
              prefix    TYPE string,
              value     TYPE string,
              indent    TYPE i,
              count     TYPE i,
              index     TYPE i.
        node ?= document.
        CHECK NOT node IS INITIAL.
        ULINE.
        WRITE: /.
        WRITE: /' DOM-TREE'.
        WRITE: /.
        IF node IS INITIAL. EXIT. ENDIF.
    *   create a node iterator
        iterator  = node->create_iterator( ).
    *   get current node
        node = iterator->get_next( ).
    *   loop over all nodes
        WHILE NOT node IS INITIAL.
          indent = node->get_height( ) * 2.
          indent = indent + 20.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
    *         element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
              WRITE: / 'ELEMENT  :'.
              WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
              IF NOT nodemap IS INITIAL.
    *           attributes
                count = nodemap->get_length( ).
                DO count TIMES.
                  index  = sy-index - 1.
                  attr   = nodemap->get_item( index ).
                  name   = attr->get_name( ).
                  prefix = attr->get_namespace_prefix( ).
                  value  = attr->get_value( ).
                  WRITE: / 'ATTRIBUTE:'.
                  WRITE: AT indent name  COLOR COL_HEADING INVERSE, '=',
                                   value COLOR COL_TOTAL   INVERSE.
                ENDDO.
              ENDIF.
            WHEN if_ixml_node=>co_node_text OR
                 if_ixml_node=>co_node_cdata_section.
    *         text node
              value  = node->get_value( ).
              WRITE: / 'VALUE     :'.
              WRITE: AT indent value COLOR COL_GROUP INVERSE.
          ENDCASE.
    *     advance to next node
          node = iterator->get_next( ).
        ENDWHILE.
      ENDFORM.                    "process_dom
    reward  points  if it is use fulll ....
    Girish

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

  • How to use Adobe Interactive forms with ISR frame work in Webdynpro forJava

    Hi,
    Anybody worked on Adobe Interactive forms with ISR frame work in Webdynpro for Java in ESS/MSS development.
    We have already searched in ISR_Cookbook_2004, however we didn't anything related webdynpro for java in that.
    Any information regarding this will be of great help.
    Regards
    Satish Kumar

    There are a number of issues here. A form that you created with LiveCycle Designer (XFA) cannot be used with FormsCentral. An Acroform, the kind you can create with Acrobat, can be used with FormsCentral, with certain limitations,  one of which is skip logic. A dynamic XFA form allows for this type of thing, but as mentioned, they don't work with FormsCentral. You can set up an Acroform to show/hide or activate/inactivate fields based on selections or entries made in other fields, but you'd have to set this up in Acrobat, not FormsCentral. So you can set up something roughly equivalent to a web form's skip logic, but you'd have to learn how to do this in Acrobat using JavaScript. There is a separate Acrobat JavaScript forum here if you have any questions.

Maybe you are looking for

  • Why does it say my wifi is connected but the web page doesn't open?

    I would be using the internet for an hour and then it disconnects but says it's still connected. I would have to turn the wifi off and turn it back on then reconnect for it to work. Should I make a genius bar appointment?

  • Installation error code 203 Firefox eBay Companion

    I keep getting installation error 203 when I try to install the Mozilla Firefox eBay companion. Does anybody know how to fix this?

  • Technical Content Activation

    Hi Iam trying to activate technical content from Bus. content are and being unsuccessfull. Steps i took     Collected the technical content objects.     Marked all of the objects to be installed.     Ran install and nothing happenned.     Then i trie

  • Bulk rename of files in subfolders

    Hello All I have a folder containing 40 subfolders, and inside each of these subfolders are a number of files (between 4 and 45 each) totalling over 500 files. Each filename starts with a string "orginalstring". What I would like is the easiest way (

  • My DW CS4 pages wont show on browser until I deleted recordset from pages. Why any one?

    Greetings, After designing my search and blog site, and went on to try to add image upload so clients and visitors could upload images, to the site, but instead things fell apart shortly after that.  I started to have serious design problem. I start