Converstion of xml doucment  to word document

Hi in one of our deveopments ,
we needed to design the word document and send it as attachment.  As it is designed with xml ( word ml ) Firewalls are not allowing this to pass through. Then we manually opened up the document using word application and performed Save As to save as pure word doc with out the xml tags. then we send it as an attchement it then worked out.  We need to automate this procedure of converting xml document to word document.
we used 'Ole' object to convert it it is working fine in Sap Gui. But with Portal 'Ole objects' doesn't t work.
So please suggest  a way to conver the xml document to word document from crm web client action .
This is a critical requirement if somebody throw light on this it would be great help to us.......wishin some body could give solution to me.
Jaffer vali shaik

Here is the sample report to open word doc with some testing message......
Report Test.
INCLUDE ole2incl.
DATA: word TYPE ole2_object, documentos TYPE
ole2_object,
documento TYPE ole2_object,
selection TYPE ole2_object,
font TYPE ole2_object.
CREATE OBJECT word 'WORD.APPLICATION'.
CALL METHOD OF word 'Documents' = documentos.
CALL METHOD OF documentos 'Add' = documento.
CALL METHOD OF documento 'Activate'.
GET PROPERTY OF word 'Selection' = selection.
GET PROPERTY OF selection 'Font' = font.
SET PROPERTY OF word 'Visible' = 1.
SET PROPERTY OF font 'Name' = 'Arial'.
SET PROPERTY OF font 'Size' = 12.
SET PROPERTY OF font 'Bold' = 1. "o 0
SET PROPERTY OF font 'Underline' = 1. "o 0
CALL METHOD OF selection 'TypeText' EXPORTING #1 = 'Word Doc Test'.
CALL METHOD OF selection 'TypeParagraph'.
CALL METHOD OF documento 'SaveAs' EXPORTING #1 = 'c:test.doc'.
CALL METHOD OF word 'Quit'.
Hope this will help.....

Similar Messages

  • Store MS word document in oracle9i as XML

    hi,
    I need to store Microsoft Word Documents in oracle 9i and I am thinking to store it as XML file. I am new to XML, can anybody give me some idea how to achieve this? More specificlly, how do I convert a word document to XML before I save it to the database and later how do I retrieve it and convert it back to word document or other format(such as .pdf document etc)?
    Besides storing the word document as XML file, are there any other ways to store it in the oracle 9i database? Is oracle 9i internet file system or interMedia a good solution too? Anybody had experience with this?

    Thanks, steven.
    My application requires "storing lots of documents, each associated with a standard record in an application". Is
    this the senario you have?
    What is SCM/Designer? Could you point me to some reference on how to use them? You mentioned "synchronized with the File System and are held as BLOBS", does that mean the word document will be stored in both places, database as BLOB and file system as file? In my case, I only want to store in database.
    I agree with you that "converting XML only adds another step in the process", but I am not sure about "probably vastly increasing the data to store!", my original thought is storing as XML instead of Word Document will save me a lot of storage space because XML is just text file, also the database retrieval will be faster. As I said I am totally new to XML, so I may be wrong.

  • Report for editing the word document with xml tags

    Hi all,
    My requirement is to edit the contents of the word document in the presentation server through report programming and save that document  in the presentation server.
    For eg if my word document contains many xml  tags with spaces < EDI_DS40 >, i would like to remove the spaces and i want it to be lyk <EDI_DS40>.Then say if i wanted to make some modification (addition, deletion,replacing with some text) in the text in some nth line of the document how can dis be dione.
    Is there any function module or bapi which serves this purpose.
    Can anyone pls guide me on dis.
    Thanks & Regards,
    Revathi.

    Hi,
    just to let you know I have sorted this.
    http://macintoshhowto.com/leopard/how-to-merge-pdf-files-with-preview-in-leopard .html
    Thanks.

  • How to merge multiple XML or Text documents into 1 Word Document?

    Hi all,
    We're looking for a way to merge multiple XML or Text documents into 1 Word document.
    All the XML or Text documents are oriented as a 'Paragraph', meaning smaller pieces of text.
    By selecting some of these XML documents, the system should be able to create a new Word document with all the selected text paragraphs included.
    The Word document can then be edited for applying a correct lay-out and the document is ready.
    Actually, we are trying to do some kind of 'mail merge' but with multiple XML or Text documents!
    Has anybody an idea whether something exist already or give us a direction how to proceed?
    Thanks in advance,
    Pascal Decock

    You use Assembler for this purpose.
    1) Assembler can be accessed through LC Java API. See http://help.adobe.com/en_US/enterpriseplatform/10.0/programLC/help/index.html
    API Quick Starts (Code Examples) > Assembler Service API Quick Starts
    2) Last week I posted on generating and merging PDF's from PostScript. Take a look at the assembly service instance in the .lca. Assembler uses DDX (Document Description XML) to describe document construction. NOTE the .lca was developed with ES 3 (aka ADEP). The .lca It contains the most basic DDX.
    <?xml version="1.0" encoding="UTF-8"?>
    <DDX xmlns="http://ns.adobe.com/DDX/1.0/">
    <PDF result="out.pdf">
      <PDF source="inDoc1"/>
      <PDF source="inDoc2"/>
    </PDF>
    </DDX>
    http://forums.adobe.com/message/4019760#4019760
    DDX Reference at http://help.adobe.com/en_US/livecycle/9.0/ddxRef.pdf
    Steve

  • How to load a base64-stream (always WORD-document) in large XML files ( 1 MB) into ORACLE 10 table

    On our Oracle Server there are multipe XML files that I have to read and put the data into an ORACLE 10 table.
    I have to threath these XML files one by one.
    In the XML there is also een base64-stream (alwasys a WORD-document) .  This base64-stream exists of 1.000.000 characters.
    How can I read this base64-stream from the XML-file into a BLOB-column of my ORACLE 10 table
    ORACLE 10
    1 XML = +/- 1 MB
    PL/SQL
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <slo xmlns="http://www.myschema.com/gasdedectie">
    <LekKey>1999_036371_509627</LekKey>
    <HuiNum>46</HuiNum>
    <Res></Res>
    <InfLig>TEST STRUI AFGESTORVEN - PLAANSTRAAT 46</InfLig>
    <XWGS>3.637028</XWGS>
    <YWGS>50.962667</YWGS>
    <Pei>KESTENS</Pei>
    <DatPei>1999-11-30T10:17:36.000+01:00</DatPei>
    <Kan> </Kan>
    <Doc>UEsDBBQABgAIAAAAIQB5gHbnswEAAHcGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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so0s6GQ4uoH/j9WCo29gxzk1P1Uc6KeCNLDi2GXQvUWPwV1U
    9rG74F3Er+MrGqpL0TuPuXt1eymKgmxpaSaMy4Lp51QwdHpWDd11wprjuoh76PgqurE8HY3RqGnCvMaA
    6VgCeiuMHD9B3ajdxJGhQrcWx0lkJcYSXbaByvE6Bg+dbuRF3pWCKhCDqrzSs25gAmFtmwTAbe1mZ0ce
    +gtG+cFg125gAL00eqC809thFCd1K/Cu0AE0AiqaU9fSToyqDI+eHkGF+QFqfN4U17/KvlxzNEnnL9y7
    4zmJFV25DiiXCo5+BR8Qn0Fz5y8nmuMWx1CA60M5p4YeD+E0L/w42JCE3j+H41t1jI5vbrU0HIPEwD+g
    1x+aMnQ9+TocDQZSry13B8MrnlfFOj9AFJKcDryLbBN68o3GsEywVJU6mUkFVA5+vJQTKYwS6HSoj2vZ
    wGOSZEn0uO0Ayz
    pQQAALNCCQAAAA==</Doc>
    </slo>

    If I understand your question correctly, the discussion in this thread
    ORA-31167: 64k size limit for XML node
    shows you do not have a lot of options.
    As you are needing to extract the contents of a node from an XML document, and that node is > 64K, you are going to need to treat the entire XML as a CLOB and use CLOB functionality (aka INSTR, SUBSTR) to find and extract what you need.
    Once your DB version is 11.1 or greater, then you can use the built-in that Billy mentions.
    Note: mdrake is Mark Drake from Oracle.

  • Programmatically adding a Word Document or PDF to a crystal report

    I am using Crystal XI for windows.  I have a VB.Net windows application that I am trying to insert a Word Document and/or PDF into.  I want to programmatically be able to add any file(s) to a crystal report.  Is there any sample code or guidance that can show me how to programmically add a file to a report?
    In the user interface, the user can click on unlimited number of PDFs, Word Documents... to insert into a Crystal Report.  Is this possible?   If so, please show steps and some sample code how to do this.
    Kind Regards,
    Jeff

    In this example, the ReportAppFactory gets initialized with the instance from the session object... If I am doing this in windows (not a web application), how would this change it if this is a windows application with no session object?
    I am connecting against an  ADO.Net (XML) file on the same computer - no connection information required... I just want to open the report file, SetDataSource to a dataset ...then do the other stuff in the example.  I think after I get past connecting to the data and opening the report, the rest of working with sections and adding ole objects I can get from the examples.  All of the sample code that I found are web based and don't show how to connect if you are windows based - not over a web page.
    I am not using a CMS or anything web / network based... I just want to connect to a local XML file that was generated from Visual Studio .Net 2005.   The example below is one of the Crystal Samples... they are all web based samples.  ...I am looking for a windows based sample to see how to connect and open a report file.
    Example:
            If Not (Session("boEnterpriseSession") Is Nothing) Then
                boEnterpriseSession = CType(Session("boEnterpriseSession"), CrystalDecisions.Enterprise.EnterpriseSession)
            Else
                'Log on to the Enterprise CMS
                boSessionMgr = New CrystalDecisions.Enterprise.SessionMgr
                boEnterpriseSession = boSessionMgr.Logon(Request.QueryString.Item("username"), Request.QueryString.Item("password"), Request.QueryString.Item("cms"), Request.QueryString.Item("authtype"))
                Session.Add("boEnterpriseSession", boEnterpriseSession)
            End If
            'get report object from session or create a new report object
            If Not (Session("boReportClientDocument") Is Nothing) Then
                boReportClientDocument = CType(Session("boReportClientDocument"), CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument)
            Else
                boEnterpriseService = boEnterpriseSession.GetService("", "InfoStore")
                boInfoStore = New CrystalDecisions.Enterprise.InfoStore(boEnterpriseService)
                boReportName = "SimpleRCAPIReport.rpt"
                'Retrieve the report object from the InfoStore, only need the SI_ID for RAS
                boQuery = "Select SI_ID From CI_INFOOBJECTS Where SI_NAME = '" + boReportName + _
                 "' AND SI_Instance=0"
                boInfoObjects = boInfoStore.Query(boQuery)
                boInfoObject = boInfoObjects(1)
                boEnterpriseService = Nothing
                'Retrieve the RASReportFactory
                boEnterpriseService = boEnterpriseSession.GetService("RASReportFactory")
                boReportAppFactory = CType(boEnterpriseService.Interface, CrystalDecisions.ReportAppServer.ClientDoc.ReportAppFactory)
                'Open the report from Enterprise
                boReportClientDocument = boReportAppFactory.OpenDocument(boInfoObject.ID, 0)
                'First determine where to add - in this case the details Area
                boArea = boReportClientDocument.ReportDefController.ReportDefinition.DetailArea
                'Create the new section object
                boSection = New CrystalDecisions.ReportAppServer.ReportDefModel.Section
                'Set the properties for the section
                boSection.Kind = CrystalDecisions.ReportAppServer.ReportDefModel.CrAreaSectionKindEnum.crAreaSectionKindDetail
                boSection.Name = "Detail2"
                boSection.Height = 1000
                boSection.Width = 11520
                'Now add the section
                boReportClientDocument.ReportDefController.ReportSectionController.Add(boSection, boArea, -1)
                'Add the reportClientDocument to session
                Session.Add("boReportClientDocument", boReportClientDocument)
            End If
    Thanks,
    Jeff
    Edited by: Jeff Dressing on Aug 20, 2008 10:48 AM

  • Can one generate a report in Word document using PL/SQL?

    We have a weekly status report application created in APEX, is there a way to generate a report in MS Word document (including formatting the doc) using PL/SQL by pulling data from Oracle database? Please shed some lights on this and any info and experience would be greatly appreciated.
    We use Oracle11g and apex version 3.1.1.00.09
    Thanks!

    Hi Tony,
    you are right, the NEW format isn't necessarily improved, also the user would need at least Office 2007 or higher.
    Still it is possible to do that ;-)
    And yes, there are other possibilities, but this question is dealing with Word documents (.doc i assume).
    Also my Statement "docx = XML" isn't clear enough. Docx is a zipped file which contains a xml file. Details: http://en.wikipedia.org/wiki/Docx
    sorry for the confusions,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at

  • Easy way to add content from a last file like a word document?

    Is there somebody who can tell me how i can display content from a word file.
    I have files with content inside on my network for example a word document.
    Inside this document i've got hyperlinks to content on other pages from the same document. Is the a way or a method how i can display the content in the portal.
    Do i need to cut and paste the word content of should i save the content as a XML or a HTML document and then add the document to portal
    Regards
    Andre

    Yeah, I have an idea... Have you tried the pdf export yet? If it is already formated then that maybe the way to go. But you may need acrobat to save it in another format. If I recall InDesign renders the pdf, which would make editing the pdf in Indesign useless.
    OK, did a quick test with PDF. Load the PDF into Acrobat and save as a word file. Place the word file into InDesign and you will have the styles paragraphs.    You just have to alter the style taste, may be fix a few paragraphs if needed.

  • Pro grammatically generate build in document ID at the footer of Word document?

    Hi All,
    i am trying to added Document ID at the footer of Word file  programatically using the following code. Following code is working only when i am uploading the document first time and its adding the ID at the footer. But problem is when i am uploading
    same file into same document library, document Id is just going away. i have tried to use ItemUpdated method but it doesn't work. what i need to modify into code, so that same document ID will be remains at the footer of document no matter how many times uploaded
    document. any help will greatly appreciated. 
    using System;
    using System.Security.Permissions;
    using System.Runtime.InteropServices;
    using Microsoft.SharePoint;
    using System.IO;
    using System.IO.Packaging;
    using DocumentFormat.OpenXml.Packaging;
    using System.Xml;
    using System.Collections.Generic;
    using Microsoft.SharePoint.Security;
    using Microsoft.SharePoint.Utilities;
    using Microsoft.SharePoint.Workflow;
    namespace AddHeaderFooterReceiver.ItemAddedEventReceiver
        /// <summary>
        /// List Item Events
        /// </summary>
     public class ItemAddedEventReceiver : SPItemEventReceiver
            /// <summary>
            /// An item was added.
            /// </summary>
            public string GetFooter()
                string footerVal = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><w:ftr xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"
    xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\"
    xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\"><w:p
    w:rsidR=\"00C24C70\" w:rsidRDefault=\"00C24C70\"><w:pPr><w:pStyle w:val=\"Footer\" /></w:pPr><w:r><w:t>Hi</w:t></w:r></w:p><w:p w:rsidR=\"00C24C70\" w:rsidRDefault=\"00C24C70\"><w:pPr><w:pStyle
    w:val=\"Footer\" /></w:pPr></w:p></w:ftr>";
                return footerVal;
            public void WDAddFooter(Stream footerContent, Stream fileContent)
                //  Given a document name, and a stream containing valid footer content,
                //  add the stream content as a footer in the document.
                const string documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
                const string wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
                const string footerContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml";
                const string footerRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
                const string relationshipNamespace = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
                PackagePart documentPart = null;
                using (Package wdPackage = Package.Open(fileContent, FileMode.Open, FileAccess.ReadWrite))
                    //  Get the main document part (document.xml).
                    foreach (System.IO.Packaging.PackageRelationship relationship in wdPackage.GetRelationshipsByType(documentRelationshipType))
                        Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), relationship.TargetUri);
                        documentPart = wdPackage.GetPart(documentUri);
                        //  There is only one officeDocument.
                        break;
                    Uri uriFooter = new Uri("/word/footer1.xml", UriKind.Relative);
                    if (wdPackage.PartExists(uriFooter))
                        //  Although you can delete the relationship
                        //  to the existing node, the next time you save
                        //  the document after making changes, Word
                        //  will delete the relationship.
                        wdPackage.DeletePart(uriFooter);
                    //  Create the footer part.
                    PackagePart footerPart = wdPackage.CreatePart(uriFooter, footerContentType);
                    //  Load the content from the input stream.
                    //  This may seem redundant, but you must read it at some point.
                    //  If you ever need to analyze the contents of the footer,
                    //  at least it is already in an XmlDocument.
                    //  This code uses the XmlDocument object only as
                    //  a "pass-through" -- giving it a place to hold as
                    //  it moves from the input stream to the output stream.
                    //  The code could read each byte from the input stream, and
                    //  write each byte to the output stream, but this seems
                    //  simpler...
                    XmlDocument footerDoc = new XmlDocument();
                    footerContent.Position = 0;
                    footerDoc.Load(footerContent);
                    //  Write the footer out to its part.
                    footerDoc.Save(footerPart.GetStream());
                    //  Create the document's relationship to the new part.
                    PackageRelationship rel = documentPart.CreateRelationship(uriFooter, TargetMode.Internal, footerRelationshipType);
                    string relID = rel.Id;
                    //  Manage namespaces to perform Xml XPath queries.
                    NameTable nt = new NameTable();
                    XmlNamespaceManager nsManager = new XmlNamespaceManager(nt);
                    nsManager.AddNamespace("w", wordmlNamespace);
                    //  Get the document part from the package.
                    //  Load the XML in the part into an XmlDocument instance.
                    XmlDocument xdoc = new XmlDocument(nt);
                    xdoc.Load(documentPart.GetStream());
                    //  Find the node containing the document layout.
                    XmlNode targetNode = xdoc.SelectSingleNode("//w:sectPr", nsManager);
                    if (targetNode != null)
                        //  Delete any existing references to footers.
                        //XmlNodeList footerNodes = targetNode.SelectNodes("./w:footerReference", nsManager);
                        //foreach (System.Xml.XmlNode footerNode in footerNodes)
                        //    targetNode.RemoveChild(footerNode);
                        //  Create the new footer reference node.
                        XmlElement node = xdoc.CreateElement("w:footerReference", wordmlNamespace);
                        XmlAttribute attr = node.Attributes.Append(xdoc.CreateAttribute("r:id", relationshipNamespace));
                        attr.Value = relID;
                        node.Attributes.Append(attr);
                        targetNode.InsertBefore(node, targetNode.FirstChild);
                    //  Save the document XML back to its part.
                    xdoc.Save(documentPart.GetStream(FileMode.Create, FileAccess.Write));
            public override void ItemAdded(SPItemEventProperties properties)
                string extension = properties.ListItem.Url.Substring(properties.ListItem.Url.LastIndexOf(".") + 1);
                if (extension == "docx")
                    //string headerContent = GetHeader().Replace("hello", properties.ListItem["Name"].ToString());
                    //string footerContent = GetFooter().Replace("Hi", properties.ListItem["Modified"].ToString());
                    //string footerContent = GetFooter().Replace("Hi", properties.ListItem["_dlc_DocId"].ToString() + "  V : " +properties.ListItem["_UIVersionString"].ToString());
                    string footerContent = GetFooter().Replace("Hi", properties.ListItem["_dlc_DocId"].ToString());
                    //string footerContent1 = GetFooter().Replace("Hi", properties.ListItem["_UIVersionString"].ToString());
                    //Stream headerStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(headerContent));
                    //Stream footerStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(footerContent));
                    Stream footerStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(footerContent));
                    //Stream footerStream1 = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(footerContent1));
                    MemoryStream fileStream = new MemoryStream();
                    fileStream.Write(properties.ListItem.File.OpenBinary(), 0, (int)properties.ListItem.File.TotalLength);
                    //WDAddHeader(headerStream, fileStream);
                    //WDAddFooter(footerStream, fileStream);
                    WDAddFooter(footerStream, fileStream);
                    //WDAddFooter(footerStream1, fileStream);
                    properties.ListItem.File.SaveBinary(fileStream);

    Instead of using Event Receiver approach have you tried looking on adding labels instead?
    Here's a helpful article on how to add labels on your document
    http://blog.isaacblum.com/2011/02/28/add-document-id-to-word-document-automatically/
    Hope this helps
    Artificial intelligence can never beat natural stupidity.

  • Create MS Word documents from data in an Apex Form/Report

    My requirement is to create editable RTF form letters from data managed by an Apex application. I do not have BI publisher available and am looking at using the XSL-FO route. Effectively I want the user to select the desired data in the Apex application, hit a button and be presented with a word document containing the data, which they can then customise.
    I know how to set Apex up to create PDFs based on reports using embedded XSL-FO but PDFs are not editable extra steps by the user. Also the user could export data to CSV and mailmerge with a word template but thats extra work for the user too.
    In the past I've used PLSQL/XML/XSL-FO with .NET to do what I want here by generating an XML file with PLSQL and using .NET to associate the XML file to XSLT/XSL-FO template files creating output as varied as .doc, .ps and .html files.
    Any ideas on acheving the same flexibility with Apex would be greatly appreciated. As my googling and forum hunting has not turned up much.
    Thanks
    FunkyMonkey

    Hi FunkyMonkey,
    Do you know Docufy | Simplify with docufy ? It's an APEX application that lets you create/generate/edit word templates. Else JasperReports Library | Free software downloads at SourceForge.net lets you generate a multitude of report formats (RTF/pdf/docx/xlsx/xml/etc.) you can use iReports to easily create xml templates for the reports, It's a lot simpler then xsl-fo.
    Regards,
    Vincent Deelen

  • Export to Word document

    Hi, Is there any way to export the tables (along with their columns) into a Word document from my data model?

    Hi,
    Sure there is. Go to File ->Reports.
    You can generate reports from there for single object or all objects.
    Output is in MS Word XML format. Could be opened with MS Word 2003 and above.

  • Upload and display Word Document in WD application

    Hello,
    I have a WD ABAP appl. where the user wants to upload an Word / Excel file (from its own local drive).
    The document shall be saved in SAP and it shall also be possible to display the document later in the WD application.
    I implemented the UI element upload in the view, to determine the path of the document.
    For the display implemented the UI element Office control.
    1. When i browse the document, the properties data, filename and mime type are filled into the bound context elements of the upload UI.
    2. The property datasource of the UI office control I bound to the same context element, that is also bound to the property data of the upload UI.
    The office control opens a word document, but the document is empty.
    Is it possible that the document is not uploaded correct?
    In another application I did an upload for a PDF doc.. There I implemented the following coding as action of the button 'Upload'.
    data lo_nd_pdf type ref to if_wd_context_node.
    data lo_el_pdf type ref to if_wd_context_element.
    data ls_pdf type wd_this->element_pdf.
    data lv_pdf like ls_pdf-pdf.
    navigate from <CONTEXT> to <PDF> via lead selection
    lo_nd_pdf = wd_context->get_child_node( name = wd_this->wdctx_pdf ).
    get element via lead selection
    lo_el_pdf = lo_nd_pdf->get_element( ).
    get single attribute
    lo_el_pdf->get_attribute(
    exporting
    name = `PDF`
    importing
    value = lv_pdf ).
    Get a reference to the from processing class.
    data: l_fp type ref to if_fp.
    l_fp = cl_fp=>get_reference( ).
    Get a reference to the PDF Object class.
    data: l_pdfobj type ref to if_fp_pdf_object.
    l_pdfobj = l_fp->create_pdf_object( ).
    set the pdf in the PDF Object
    l_pdfobj->set_document( pdfdata = lv_pdf ).
    set the PDF Object to extract data the Form data.
    l_pdfobj->set_extractdata( ).
    execute call to ADS
    l_pdfobj->execute( ).
    get the PDF Form data
    data: pdf_form_data type xstring.
    l_pdfobj->get_data(
    importing
    formdata = pdf_form_data ).
    convert the xstring from data to string so it can be processed using the iXML classes
    data: converter type ref to cl_abap_conv_in_ce,
    formxml type string.
    converter = cl_abap_conv_in_ce=>create( input = pdf_form_data ).
    converter->read(
    importing
    data = formxml ).
    pull in the iXML type group.
    type-pools: ixml.
    get a reference to iXML object
    data:l_ixml type ref to if_ixml.
    l_ixml = cl_ixml=>create( ).
    get iStream object from StreamFactory
    data: streamfactory type ref to if_ixml_stream_factory,
    istream type ref to if_ixml_istream.
    streamfactory = l_ixml->create_stream_factory( ).
    istream = streamfactory->create_istream_string( formxml ).
    create an XML document class that will be used to process the XML
    data: document type ref to if_ixml_document.
    document = l_ixml->create_document( ).
    create the parser class
    data: parser type ref to if_ixml_parser.
    parser = l_ixml->create_parser( stream_factory = streamfactory
    istream = istream
    document = document ).
    parse the XML
    parser->parse( ).
    define XML Node type object
    data: node type ref to if_ixml_node,
    attributes type ref to if_ixml_named_node_map.
    get the psi sales data Node and value.
    data ls_psi_sales type wd_this->element_psi_sales.
    data: lt_dfies type table of dfies,
    ls_defies type dfies.
    call function 'DDIF_NAMETAB_GET'
    exporting
    tabname = 'ZCM_PSI_SALES'
    ALL_TYPES = ' '
    LFIELDNAME = ' '
    GROUP_NAMES = ' '
    UCLEN =
    IMPORTING
    X030L_WA =
    DTELINFO_WA =
    TTYPINFO_WA =
    DDOBJTYPE =
    DFIES_WA =
    LINES_DESCR =
    tables
    X031L_TAB =
    dfies_tab = lt_dfies
    exceptions
    not_found = 1
    others = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    data: lv_fieldname type string.
    field-symbols <fs_field> type any.
    loop at lt_dfies into ls_defies.
    lv_fieldname = ls_defies-fieldname.
    node = document->find_from_name( name = lv_fieldname ).
    assign component lv_fieldname
    of structure ls_psi_sales
    to <fs_field>.
    if <fs_field> is assigned.
    <fs_field> = node->get_value( ).
    endif.
    endloop.
    WRITE DATA INTO CONTEXT
    data lo_nd_psi_sales type ref to if_wd_context_node.
    data lo_el_psi_sales type ref to if_wd_context_element.
    navigate from <CONTEXT> to <PSI_SALES> via lead selection
    lo_nd_psi_sales = wd_context->get_child_node( name = wd_this->wdctx_psi_sales ).
    get element via lead selection
    lo_el_psi_sales = lo_nd_psi_sales->get_element( ).
    set all declared attributes
    lo_el_psi_sales->set_static_attributes(
    exporting
    static_attributes = ls_psi_sales ).
    Do I need such a code also to upload a word doc?
    Which interface / class exists for word documents? (for PDF upload there is the interface IF_FP)
    How can I save a document in SAP? (as MIME Object?  with which method?)
    I hope someone can help me!?
    BR

    You can use the fileupload and filedownload uielements.
    Check these links:
    [File Upload|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b3/be7941601b1d09e10000000a155106/content.htm]
    [File Download|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/09/a5884121a41c09e10000000a155106/content.htm]
    When you upload a file and save in SAP, are you saving it as xstring.
    If yes follow these steps for filedownload.
    Follow these steps for file download:
    1 Create FileDownload uielement in your View
    2.Create an Attribute of type xstring.
    3.Bind this attribute to the data property of your Filedownload uielement.
    4. during fileuplaod as you are saving the document in xstring format, fetch the same from your database table and pass the value to filedownload i.e set the attribute bound to data property of filedownload uielement with the xstring content.

  • Acrobat won't convert Word documents within the Acrobat program

    I am running OS 10.5.2 on my MacBook Pro. I also have Microsoft Office 2004. I just installed Acrobat 8.0 Pro, patched it all up from the downloads on the website and was ready to convert some Word documents that I have to give to my boss. Went through Acrobat and it gives me the following error message:
    "Acrobat could not open 'Dissertation-1.1.doc' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
    To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF or use the Acrobat toolbar found in Microsoft Office applications."
    The file was not an attachment and I don't think it is damaged (or at least I hope not). I can make the PDF document in Word or any of the other Office apps with the tool bar or the PDF printer with Distiller but eventually I'm going to have to combine everything and just thought it would be easier to work through Adobe.
    Has anyone else had this problem or has come about at a solution for converting within Adobe? I might just be missing something obvious but I would appreciate any help that anyone can give. Thanks!

    It was telling you actually what you needed to do.
    Go into word2004 open the document and to Page setup and choose Adobe Printer. Then go to Print menu and choose print File. Then name the file and select desired location.
    What actually happens is acrobat will create a hidden .ps File and check it. (up to 3 times if needed) before writing the hidden.ps file. The Distiller is open in Background hidden and converts the .ps file to a PDF file the file is checked and retried up to three times if something isn't right. Then The Pdf file is written to disk finally the hidden .ps file is deleted and the pdf file appears.
    If your still using 2004 a little icon may show up in word called pdfmaker. This is a little VBA script that does the equivent of above. however its ver slow and if you have a long document your hair may turn gray before it finishes.
    In Office2008 for Mac VBA is dead and laid out in its coffin with its arrival. so PDFMaker is a useless piece of code. Thankfully going into menu view options unchecking PDFMaker actually does banish it from the screen and does don't try to get reinserted if you banish it.
    By the way because of the new XML Based Code in Office2008 they have a word to PDF Translator built in just go to Save As... and scroll down until you see PDF.

  • How do I open a word document on an I pad?

    I cannot open word documents in Pages on my I pad2. They are not protected. I can go no further than "open in Pages" in my e-mail account. What am I doing wrong?

    What version of Word do you have?
    If you are emailing the documents to yourself, it sounds like this should work.
    Pages for iOS: Supported file formats
    Import:
    Pages ’09 for Mac
    Microsoft Word - Office Open XML (.docx) and Office 97 or later (.doc)
    Plain Text files (.txt)
    Can you "Save As" in Word and try a different format?

  • Opening word document in a browser

    Hi Friends,
    I am working on a web application which has a websphere as a web server.
    I want to open a word document or any other MIME type file in a browser. I know how to open a word document by setting the content type in a response. But I dont want to use that.
    I have the same code, on the other server which works absolutely fine without any issues.
    In the same code, no content type is set for response as the file is called direcly using "config.getServletContext().getRequestDispatcher("FILE PATH")".
    web.xml are identical on both the server.
    Can anyone please suggest what is the other thing that decides the content type for the file to be opened in a browser?
    Thanks & Regards
    Ketan

    To open an Microsoft Word document, you would set the response object's content type to "application/msword" instead of "application/pdf":
    // MIME type for MSWord doc
    res.setContentType( "application/msword" );
    For an Excel document, use the MIME type "application/vnd.ms-excel". In that MIME type, vnd refers to application vendor that must be included to open the file.
    In some cases, the browser doesn't recognize the file's MIME type. That often happens when the required plug-in hasn't been installed for a certain file type. In those cases, the browser will pop up a dialog box, asking the user whether he or she wants to open the file or save it to disk.
    Content disposition
    An HTTP response header named content-disposition allows the servlet to specify information about the file's presentation. Using that header, you can indicate that the content should be opened separately (not actually in the browser) and that it should not be displayed automatically but rather upon some further action by the user. You can also suggest the filename to be used if the content is to be saved to a file. That filename would be the name of the file that appears in the Save As dialog box. If you don't specify the filename, you are likely to get the name of your servlet in that box. To find out more about the content-disposition header, check out Resources.
    In the servlet, you want to set that header as follows:
    res.setHeader("Content-disposition",
    "attachment; filename=" +
    "Example.pdf" );
    // attachment - since we don't want to open
    // it in the browser, but
    // with Adobe Acrobat, and set the
    // default file name to use.
    If you were opening an Microsoft Word file, you would choose:
    res.setHeader("Content-disposition",
    "attachment; filename" +
    "Example.doc" );

Maybe you are looking for

  • Import game center profile from apple id to another apple id

    Hello i want to ask question if is possible import gamecenter profile from apple id to my new apple id because i have on that gamecenter profile lot of games profiles and i want them on the new apple id. Thanks

  • ABAP Proxy in CONS doesnu0092t work!

    Hi guys, Scenario: ERP -> PI I’m using value mapping tables in PI 7.1 and the standard mass data outbound interface as well (ValueMappingReplicationOutSynchronous). In DEV sys everything works fine, but in CONS sys not really!!! I run the transported

  • Records Management - automaticaly add element to record

    Hello, I try to add an element to a record using the bapi "bapi_record_addelement", but I get an error-message that the number of poid-parameters is not equal to those in the registry information. My ABAP-Code is the following: *& Report  Z_RECORD_AD

  • Limiting rows displayed from user-selection on dashboard prompt

    Hi, I'm looking for a way to limit the number of rows displayed after a user has made a selection using a dashboard prompt. Here is my scenario: User selects 24 periods of data using an 'In Between' dashboard prompt (i.e. Jan05-Dec06). 24 rows are re

  • Can we have more than one contructor for one class?

    I need to provide more than one constructor for one class because I need to have one parameter passed to one constructor and many to another. Is that possible and how it will affects in the instantiation of the object? Thanks again Jorg3