Appending to a Word document

Two items:
1) Is there a way to append to an already existing Word
document? I can create the Word document through AW and it updates
when then program runs, but if the file has been created outside of
AW, then the .doc does not get updated.
2) Rather than appending to the end of a Word document, is
there a way to append to the top or at least designate where the
next appended text should be written?
Thanks!

Authorware's AppendExtFile function will (should?) append
text to any document you reference. I'm surprised the Word doc does
not get updated at all.
However, I could certainly see the document not being updated
properly (and maybe that's just what you're seeing). The
Write/Append functions just write plain old ASCII text. Word is not
just plain old ASCII text. After appending, open the Word document
in notepad to see all the other, um, garbage Word adds to the
document. I would bet the text your appending is indeed at the
bottom, but its below Word's formatting text so you can't actually
see it...?
So, in essence, appending text to an actual Word doc probably
won't work. I'm not sure how to overcome that... Are these docs
that others will create? If not, you could try to make them in
WordPad, perhaps, and see if Authorware will update them. But once
opened and saved in Word, you're back to where you started.
There was a discussion here or the List that mentioned an
ActiveX-like control that could possibly do this. Search?
To append to the top of a block of text, you have to read it
in to a variable, add the contents to the top, then write it all
out to a new document.
Oh, also for both issues, look at the FileIO Xtra (select
'Xtra fileio' in the Functions category drop-down). Using this may
give you a solution - at least to appending at the top. Not sure
it'll work with Word, considering the hidden garbage in there....
Erik

Similar Messages

  • Appending to a word document hyperlink text

    Hey, Is it possible to change the hyperlink text not the address? I would like to append to it not completely replace it. This is my example. I would like the hyperlink to display "Fig 1" instead of just the number "1". Is this
    possible somehow? thanks.

    Hi Rundownbassman92,
    This script below may be helpful for you to edit the text of hyperlink in a Word Document:
    $word = New-Object -ComObject word.application
    $document = $word.documents.open("word file path")
    $hyperlinks = @($document.Hyperlinks)
    $hyperlinks | ForEach {
    $newtext ="Fig "+ $_.TextToDisplay # add "Fig" before original text
    $_.TextToDisplay=$newtext
    $document.save()
    $word.quit()
    Best Regards,
    Anna Wang

  • How to Append two  word documents into single  using   java

    How to Append two word documents into single using java
    we tried this but it's not append the one word document to other
    source code:public class AppendTwoWordFiles {
         public static void main(String []arg)throws IOException
              FileInputStream fi=null;
              FileOutputStream fo=null;
              try {
                   System.out.println("Enter the source file name u want to append");
                   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                   File f1=new File(br.readLine().toString());
                   System.out.println("Enter the Destination file name ");
                   File f2=new File(br.readLine().toString());
                   fi = new FileInputStream(f1);
                   fo = new FileOutputStream(f2,true);
                   byte b[]=new byte[2];
                   while((fi.read(b))!=-1);
              fo.write(b);
    System.out.println("Successfully append the file");
              } catch (FileNotFoundException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              finally{
              fi.close();
              fo.close();
    plz reply me quickly ,,,what can i follow

    Use this code ..
    and give the path of the both file like this.....
    source file ---- C:/workspace/Practice/src/com/moksha/ws/test/practice.text
    destination file ---- C:/workspace/City/src/com/moksha/ws/test/practice1.text
    import java.io.*;
    public class AppendTwoWordFiles {
         public static void main(String[] arg) throws IOException {
              FileInputStream fi = null;
              FileOutputStream fo = null;
              try {
                   System.out.println("Enter the source file name u want to append");
                   BufferedReader br = new BufferedReader(new InputStreamReader(
                             System.in));
                   File f1 = new File(br.readLine().toString());
                   System.out.println("Enter the Destination file name ");
                   File f2 = new File(br.readLine().toString());
                   fi = new FileInputStream(f1);
                   fo = new FileOutputStream(f2, true);
                   byte b[] = new byte[2];
                   int len = 0;
                   while ((len = fi.read(b)) > 0) {
                        fo.write(b, 0, len);
                   System.out.println("Successfully append the file");
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
              } finally {
                   fi.close();
                   fo.close();
    }

  • Appending MS-Word documents into one document.

    Greetings,
    I've used the MS-Office VI's to create MS-word documents using a .dot template.   It is very handy and provides very good results with little effort.  
    For various intended reasons I create in number of one page documents.
    Anyone know how to append .doc files into one .doc file?  Any active-x commands able to do this?  
    Any help would be appreciated.
    Modemmad99

    Check out this other discussion forum post. It will show you how to use Active X commands or Report Generation Toolkit VIs to append documents together.
    Stephanie O.
    DIAdem Product Manager
    National Instruments

  • Merge/append the contents of a pdf file to an MS Word document in JAVA

    Hi experts,
    I have a requirement to merge/append the contents of a pdf file to an ms word document(Not to be done by including pdf file objects in word). Please suggest some java libraries or ways to do it using java. Any pointers would be appreciated.
    Regards,
    Subin

    Odonnells52 you will still need to install Adobe Acrobat Professional prior to being able to make edits to PDF or utilize Acrobat.   By default the installation files have been saved to your download folder.
    If you continue to face difficulties with the Adobe Download Assistant then please see Troubleshoot Adobe Download Assistant.
    You can also download the installation files directly from Download Acrobat products | Standard, Pro | XI, X if you are unable to locate the downloaded installation files.

  • Ipad won't open Word documents without .doc appended

    My ipad won't open word documents attached to emails that don't have .doc appended, however my iphone does this flawlessly. Is this normal?

    Mine won't either. I was wondering if it had something to do with installing the pages app. My attachments with .doc are showing as pages docs.

  • Word document became corrupt when attempting to append...

    I'm going crazy here. I'm using RoboHelp 4.1 and I am having
    an issue with trying to create printed documentation. I was
    receiving the error message, 'The Word document became corrupt when
    attempting to append a malformed topic.' Then it would say failed
    to update 'topic name'. So in trying to fix it I deleted the entire
    folder which contained the file where it blew up, and tried
    recompiling it. It went past the point where I had removed the
    folder and blew up on a topic in the next folder and gave the same
    error...so I deleted that folder also. Now it will make it entirely
    through the printed documentation process....but at the end of
    compiling it, it tells me Failed to Update images....but at least
    now it will give me a finished document (it just has a bunch of
    dead linked images). Is this an issue that would be cured with an
    upgrade to X5 or is this something else that I have not thought of
    yet? Any help will be greatly appreciated.

    Hi, jdammen.
    The first thing I suggest is a search of the forums on the
    word "malformed" - you are not alone! Seems like the problem can
    have multiple causes: one bad topic, a bad style in the CSS, not
    enough RAM, some kind of weird invisible running corruption...
    The solutions offered seem to fall into general categories -
    1) generate with half the topics, then a quarter, etc. to narrow
    down and kill the bad topic, 2) change all styles to Normal and see
    if printdoc generates correctly, 3) take a copy of the project and
    restore it from .hhp (see
    Peter Grainge's website for
    help), 4) start over.
    I'm afraid they all have one thing in common - trial and
    error. You're just going to have to slog through this.
    BTW, this happens in X5 - I don't think an upgrade will be a
    quick solution for you.
    Sorry, and good luck.
    Elisa

  • Automatic creation of MS Word Documents within a Report

    Dear Experts,
    within my report which creates automatically activities in a background process I have to create MS Word Documents and
    attach this Word Documents to the Activity.
    The Word Document does have a Logo and the text is changing with every Activity created.
    What would be the best technical solution for the creation of this word documents for my report?
    Best Regards
    Oliver

    Hello, I have found out what was the problem. In the end I have used method EDITREPLACE and not WW2_EDITREPLACE and I put the method EDITREPLACE more to the end of my ABAP Code:
    REPORT  z_prueba_oliver.
    TYPES: BEGIN OF ty_partner,
                 nif            TYPE bu_partner,
                 name_org1      TYPE bu_nameor1,
                 conting_com    TYPE c LENGTH 2,
                 fecha_efecto   TYPE zbufecha_ef,
                 END OF ty_partner.
    DATA:  lt_partner1     TYPE TABLE OF ty_partner,
                 ls_partner1     TYPE ty_partner,
                 lv_file_save_as TYPE c LENGTH 40,
                 lv_contador     TYPE n LENGTH 3.
    * Include necesario para la declaracion de objetos OLE2
    INCLUDE ole2incl.
    * Declaraciones para la llamada a WORD.
    DATA zword TYPE ole2_object.
    CLEAR zword.
    ls_partner1-nif = 'X7510034M'.
    ls_partner1-name_org1 = 'Razon Social 1'.
    APPEND ls_partner1 TO lt_partner1.
    ls_partner1-nif = 'X7510034M'.
    ls_partner1-name_org1 = 'Razon Social 2'.
    APPEND ls_partner1 TO lt_partner1.
    ls_partner1-nif = 'X7510034M'.
    ls_partner1-name_org1 = 'Razon Social 3'.
    APPEND ls_partner1 TO lt_partner1.
    ls_partner1-nif = 'X7510035M'.
    ls_partner1-name_org1 = 'Razon Social 4'.
    APPEND ls_partner1 TO lt_partner1.
    ls_partner1-nif = 'X7510035M'.
    ls_partner1-name_org1 = 'Razon Social 5'.
    APPEND ls_partner1 TO lt_partner1.
    LOOP AT lt_partner1 INTO ls_partner1.
      AT FIRST.
        CREATE OBJECT zword 'WORD.BASIC'.
    * Se abre el fichero que contiene la plantilla de la carta
        CALL METHOD OF zword 'FILEOPEN'
          EXPORTING
          #1 = 'C:DOCSPRUEBA_1.DOC'.
      ENDAT.
    * Se selecciona todo el texto del archivo PRUEBA_1.DOC
      CALL METHOD OF zword 'EDITSELECTALL'.
    * Se copia el texto seleccionado al portapapeles
      CALL METHOD OF zword 'EDITCOPY'.
    * Se crea un documento nuevo, al que WORD llama documento1
      CALL METHOD OF zword 'FILENEW'.
    * Se pega el texto del portapapeles a documento1
      CALL METHOD OF zword 'EDITPASTE'.
    * Posicionar al principio del documento
      CALL METHOD OF zword 'STARTOFDOCUMENT'.
    * Posicionar al principio del documento
      CALL METHOD OF zword 'STARTOFDOCUMENT'.
    * Se selecciona todo
      CALL METHOD OF zword 'EDITSELECTALL'.
    * Se borra la selección
      CALL METHOD OF zword 'EDITCLEAR'.
    * Se incorpora el texto original de PRUEBA_1.DOC
      CALL METHOD OF zword 'EDITPASTE'.
    *IF ls_partner1-conting_com is initial.*
       *CALL METHOD OF zword 'EDITREPLACE'*
        *EXPORTING*
        *#01 = '#linea2y3#'*
        *#02 = 'de la cobertura de Accidentes de Trabajo, de los siguientes código de cuenta de cotización (CCC):'*
        *#03 = 0*
        *#04 = 0*
        *#05 = 0*
        *#06 = 0*
        *#07 = 0*
        *#08 = 0*
        *#09 = 0*
        *#10 = 1*
        *#11 = 0*
        *#12 = 1.*
    *else.*
         *CALL METHOD OF zword 'EDITREPLACE'*
        *EXPORTING*
        *#01 = '#linea2y3#'*
        *#02 = 'de la cobertura de Accidentes de Trabajo y Contingencias Comunes, de los siguientes código de cuenta de cotización (CCC):'*
        *#03 = 0*
        *#04 = 0*
        *#05 = 0*
        *#06 = 0*
        *#07 = 0*
        *#08 = 0*
        *#09 = 0*
        *#10 = 1*
        *#11 = 0*
        *#12 = 1.*
    *ENDIF.*
      *CALL METHOD OF zword 'EDITREPLACE'*
        *EXPORTING*
        *#01 = '#codprov#'*
        *#02 = ls_partner1-nif*
        *#03 = 0*
        *#04 = 0*
        *#05 = 0*
        *#06 = 0*
        *#07 = 0*
        *#08 = 0*
        *#09 = 0*
        *#10 = 1*
        *#11 = 0*
        *#12 = 1.*
      CALL METHOD OF zword 'EDITREPLACE'
        EXPORTING
        #01 = '#nomprov#'
        #02 = ls_partner1-name_org1
        #03 = 0
        #04 = 0
        #05 = 0
        #06 = 0
        #07 = 0
        #08 = 0
        #09 = 0
        #10 = 1
        #11 = 0
        #12 = 1.
    * Se reemplaza el campo #nomprov# con el valor de la tabla interna.
      CALL METHOD OF zword 'EDITREPLACE'
        EXPORTING
        #01 = '#FECHA_EFECTO#'
        #02 = '10 de Junio de 2010'
        #03 = 0
        #04 = 0
        #05 = 0
        #06 = 0
        #07 = 0
        #08 = 0
        #09 = 0
        #10 = 1
        #11 = 0
        #12 = 1.
      lv_contador = lv_contador + 1.
      CONCATENATE 'C:DOCS' 'PRUEBA' lv_contador '_' sy-datum '.DOC' INTO lv_file_save_as.
    * Se cierra el documento activo, documento1 con opción de salir sin salvar
      CALL METHOD OF zword 'FILESAVEAS' EXPORTING #1 = lv_file_save_as.
    * Se cierra el documento activo PRUEBA.DOC con opción salir sin salvar
      CALL METHOD OF zword 'DOCCLOSE' EXPORTING #1 = 2.
      AT LAST.
    *   Se cierra WORD
        CALL METHOD OF zword 'APPCLOSE'.
    *   Se libera el objeto ZWORD
        FREE OBJECT zword.
      ENDAT.
    ENDLOOP.

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

  • Displaying Word Document from a Database

    Let me try to explain this.
    I can upload and store a Word Document in an Oracle database
    (BLOB column) but now I need to extract that Word document and
    place a pointer to it on the Web. Can someone explain to me how
    this is done?
    I'm trying to do something like have an image displayed on
    the Web and when you click on it the Word Document is opened.
    Follow me on that? So, if there are 15 Word documents in the
    database, then the web page would have 15 images all pointing to
    each separate Word document.
    Has anyone done this?

    Don't take my word on this, but I think this should work;
    I've done this in the past to send dynamically-generated CSV files
    to the user, which is in a way (at least at the perspective of
    what's being outputted to the user) the same thing.
    First, obviously, you need to retrieve the Word document data
    from the database. We'll say you put that in a variable called
    'wordDoc'.
    <cfset wordDoc = someQuery.wordDataObj />
    Next, we need to set the 'Content-disposition' HTTP header,
    to tell the client's browser that we're sending a file, and that we
    want you to call it somefile.doc by default. We'll do this with the
    <cfheader> tag (note that if you use <cfflush> in the
    application, this tag (and thus, this approach)
    will not work.
    <cfheader name="Content-disposition" value="attachment;
    filename=somefile.doc" />
    Almost there. Now we need to set the Content-type HTTP
    header, to tell the browser what kind of data is coming, and then
    give it the actual file data. We'll use the <cfcontent> tag
    to do both of these things.
    <cfcontent type="application/msword"
    reset="yes">#wordDoc#</cfcontent><cfabort>
    If memory serves, this should be all you need. Note the
    <cfabort> after the closing <cfcontent> tag, I've had
    problems in the past with additional output on the page after these
    tags being appended to what gets sent to the browser, so I use a
    <cfabort> afterwards to make sure nothing more gets sent
    after the data we want. Also, at least with CFMX7, I've noticed
    that debugging output tends to get added in too regardless, so I
    typically put a <cfsetting showdebugoutput="false" /> at the
    top of the file, too.
    I can't guarantee this will work, I haven't tested this
    particular situation, but if it doesn't, it ought to be close. Let
    me know if I'm wrong.
    Attached is what should be the code without my commentary /
    rambling interspersed.

  • Unable to save Word documents when accessing them directly from the site because the document never converts from a read-only even though the User chooses to enable editing

    Issue has only popped up recently and cannot reproduce in a Test environment.  Unaware of any SharePoint changes, so hoping someone can point me in the correct direction.
    Previously Word document did not have to be physically checked out, but rather the editing of the doc also checked out the doc in a document library. This is the way we want it to remain –
    no manual check-out process. Now if a doc is edited without being checked-out, there is an issue with the process as the application thinks the doc is read-only (message received when trying to save the doc) even if enable editing is selected. The
    following message appears when you try to save the document:
      This message can appear if you have been editing a file that was opened as read-only. A file opened as read-only will have (Read-Only) appended to the file name as it appears in the title bar of Word. You can still save the document, but you must
    save it by using a different file name. If you use Windows Explorer to change the read-only properties of the file, while the file is open in Word, it will not enable Word to save the file. Word must open a non-read-only version of the file in order to save
    it by using its original file name. If you have not made any changes to the file, you can close it, and then use the following steps to make the file writeable. 1. Click the File tab, and then click Open. 2. Browse to the file and right-click it. 3. Click
    Properties, and then clear the Read-Only check box. 4. Reopen the file. If you have made changes to a read-only file, you can save it, and then use the following steps to give the modified file the original file name. 1. Click the File tab, and then click
    Save As. 2. Enter a different file name, and then click Save. 3. NOTE: Adding "Rev1", or "Mod1" to the original file name may help you to remember it later. 4. Click the File tab, and then click Close. 5. Open Windows Explorer. 6. Browse
    to the original read-only file. 7. Rename the read-only file. 8. Browse to the new file. 9. Rename the new file to the name of the original file. Do not delete the read-only file until after you have determined you no longer need it.
    Previously, when check-out was optional, a file was checked out automatically when someone opened it for editing, unless it was already checked out. The editing commands notified the User that the file is being/was checked out.  The real issue is the
    word doc can no longer be saved as the application still believes the doc is read-only.

    Hi, 
    According to your description, you give the domain admin full control over files on the old file server, but you cannot move the files to the new file server. After pull the files from the old to the new file server, the domain admin can only read the files
    on the new file server.
    How did you move the files from the old file server to the new file server? Did you setup replication between the two file server or use robocopy? 
    Please check the files permissions on the new file server to see if the permissions are changed, then share the folder on the new file server to everyone to see the result.
    Regards, 
    Mandy
    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.

  • Bold syntax in word document

    hi all,
    i try to bold syntax and create spaces in aword document.
    is anyone know how can i do that?
    thanks,
    dana.
    my code is:
    concatenate sy-datum  lt_contents_txt-LINE into lt_contents_txt-LINE.
    append lt_contents_txt.
    CLEAR lt_contents_txt.
    concatenate text-002 ZZMISCHOK1 '-' ZZNAMECHOK1 ' .' text-003 ltext into
    lt_contents_txt-line.
    append lt_contents_txt.
    CLEAR lt_contents_txt.
      CLEAR lwa_packing_list.
      lwa_packing_list-doc_size = 1.
      lwa_packing_list-doc_type = 'TXT'.
      APPEND lwa_packing_list TO lt_packing_list.
      ls_document_data-doc_size  = lv_num_of_lines * 255.
      ls_document_data-obj_langu = sy-langu.
        lt_receivers-receiver = p_email." '[email protected]'.
        lt_receivers-rec_type = 'U'.
        APPEND lt_receivers.
        CLEAR lwa_packing_list.
        lwa_packing_list-transf_bin = ' '.
        lwa_packing_list-body_start = 1.
        lwa_packing_list-body_num   = lv_num_of_lines.
        lwa_packing_list-doc_type   = 'DOC'.
        lwa_packing_list-obj_name   = 'JOB_LIST_MMPV'.
        lwa_packing_list-obj_descr  = 'Att-Log'.
        APPEND lwa_packing_list TO lt_packing_list.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = ls_document_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          IMPORTING
            sent_to_all                = lv_sent_to_all
            new_object_id              = lv_new_object_id
          TABLES
            packing_list               = lt_packing_list
            contents_txt               = lt_contents_txt
            receivers                  = lt_receivers
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.
    i create a word document and send by email.

    How do I post a message?
    In the first field, the Subject field, type a title for your message.
    This is the only part of the message that shows up on the message listing page, so try to make it something that will be clear and concise. Use keywords about your topic.
    In the second field, the Body field, type your message. Put details about your topic here. Use the WYSIWYG (What You See Is What You Get) Editor to format your post for easier reading. If you are posting on a technical topic, it is helpful to include all pertinent information regarding your inquiry in the body.
    Click Check Spelling to look for misspelled words, or you can click Preview Post to see what your post will look like on the boards.
    When you are happy with your message, click the Submit Post button.

  • How to pass a Word Document into a byte array?

    Hi All
    I have an application wherin i select multiple files and send them over to a webservice method.The files selected are zipped internally and sent across as a single entity.
    I could pass the files and retrieve them using my test tool to check thir successful send and retrieval as long as the files were in "text" format.
    But now i need to figure a way out to pass word docs or any other content types.I tried passing word docs in the mechanism that works fine for "text" files.But when i retrieve the files,and try to open the word documents the MS Word states that "the file is corrupt and cannot be opened". The following is the code.
    public byte[] getContent(IDfSessionManager sessionManager,String repositoryName, String objectIdString) {
       ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
       StringBuffer sb = new StringBuffer("");
        try {
              System.out.println("Repository Name " + repositoryName);
               mySession = sessionManager.getSession(repositoryName);
               // Get the object ID based on the object ID string.
                DfId dfId = new DfId(objectIdString);
                 if (dfId.isObjectId())
         System.out.println("Successfully fetched id " + dfId);
              IDfSysObject sysObj = (IDfSysObject) mySession.getObject(dfId);
              System.out.println("Content Type ++++++ " + sysObj.getContentType());
              ByteArrayInputStream buf = sysObj.getContent();
              int i = 0;
             InputStreamReader readInput = new InputStreamReader(buf, "UTF8");
             BufferedReader br = new BufferedReader(readInput);
             while (br.ready()) {
            sb.append(br.readLine());
             sb.append("\n");
              String captureText = sb.toString();
         try {
         is = new ByteArrayInputStream(captureText.getBytes("UTF-8"));
                         } catch (UnsupportedEncodingException e) {
                                    e.printStackTrace();
         final int BUF_SIZE = 1 << 8; // 1KiB buffer
         byte[] buffer = new byte[BUF_SIZE];
                    int bytesRead = -1;
                     while ((bytesRead = is.read(buffer)) > -1) {
         outputStream.write(buffer, 0, bytesRead);
         is.close();
         System.out.println("This is byte acquisition ###### >>>>>>>>>>>>>>>>>>>");
         binaryData = outputStream.toByteArray();
         File temp1 = File.createTempFile("Test",".docx");
         FileOutputStream fos = new FileOutputStream(temp1);
         fos.write(binaryData);
         fos.close();
              // Handle any exceptions.
              catch (Exception ex) {
              ex.printStackTrace();
              finally {
                   sessionManager.release(mySession);
              return binaryData;
         }I assume that UTF8 must be applicatbe only to deal with .txt files.
    I would really appreciate your guidance to obtain a way to acquire data from word documents so that i could open and read them without errors.
    Thank You
    Regards

    Hi B1J001
    Following your suggestion i curtailed the code as follows:
    public byte[] getContent(IDfSessionManager sessionManager,String repositoryName, String objectIdString) {
       ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
       StringBuffer sb = new StringBuffer("");
        try {
              System.out.println("Repository Name " + repositoryName);
               mySession = sessionManager.getSession(repositoryName);
               // Get the object ID based on the object ID string.
                DfId dfId = new DfId(objectIdString);
                 if (dfId.isObjectId())
         System.out.println("Successfully fetched id " + dfId);
              IDfSysObject sysObj = (IDfSysObject) mySession.getObject(dfId);
              System.out.println("Content Type ++++++ " + sysObj.getContentType());
              ByteArrayInputStream buf = sysObj.getContent();
              *String testbuf = buf.toString();*
              *testbytearray = testbuf.getBytes();*
            File temp1 = File.createTempFile("Test",".docx");
            FileOutputStream fos = new FileOutputStream(temp1);
            fos.write(testbytearray);
            fos.close();
         // Handle any exceptions.
         catch (Exception ex) {
         ex.printStackTrace();
         finally {
         sessionManager.release(mySession);
         return testbytearray;
         }I am using just the ByteArrayInputStream to access the content. Still my attempt to open the document from the temporary file yields "file corrupt message".Am i going the right path?
    Thank You
    Regards

  • Opening a Word Document with a Java program in Windows

    When running a Java program in Windows, is it possible to have a button where when it is clicked it will open a Word document?
    If so, is it hard and can someone tell me how to do it??
    Thanks

    try this instead of Excel.exe you have to use Word.exe
    1. Declare your button
                   JButton butexlcom = new JButton("Carnet Offre");
                   butexlcom.addActionListener( new ButExlCommercial(msgout));
                   butexlcom.setBounds(215,510,110,30);
                   c.add( butexlcom );
    2. run your word document.
    class ButExlCommercial implements ActionListener {
         private JTextArea msgout;
         public ButExlCommercial( JTextArea msg) {
         msgout = msg;
         public void actionPerformed( ActionEvent e ) {
              try {
                   Runtime.getRuntime().exec("c:\\Program Files\\Microsoft Office\\Office\\Excel.exe NameWordDocument");
              catch(Exception en) {
                   msgout.append( "\n*** PROBLEME WORD ***\n" );
    }

  • How to convert a Word document to text or html in an ABAP program

    Hi,
    At my client's site, for the recruitment system, they have the word processing system set to RTF, instead of SAP Script. This means that all the correspondence is in Word format. A standard SAP program takes the word letter, loads word, does the mail merge with the applicant's info and then sends the document to a printer.
    The program name is RPAPRT05. The program creates a document proxy (interface I_OI_DOCUMENT_PROXY) and manipulates the document using the methods of the interface.
    Now what we want to do is to instead of sending the document to a printer, we want to email the document contents to the applicant. But I don't know how to get the content from the Word document into text or html format so that I can make an email from it.
    I know I can send an email with the word document as an attachment, but we'd prefer not to do that.
    I would appreciate any help very much.
    Thanks

    Ok, here's what I ended up doing:
    First of, in order to call FM 'CONVERT_RTF_TO_ITF' you need the RTF document in a table with line length 156. The document is returned from FM 'DP_CREATE_URL' in a table with line length 132. So first I convert the table:
        Transform data table from 132 character lines to
        256 character lines
          LOOP AT data_table INTO dataline.
            IF newrow = 'X'.
            Add row to new table
              APPEND INITIAL LINE TO xdatatab ASSIGNING .
              newrow = space.
            ENDIF.
          Convert the raw line of old table to characters
            ASSIGN dataline TO .
          Check line lengths to determine how to add the
          next line of old table
            newlinelen = STRLEN( newline ).
            ADD addspaces TO newlinelen.
            linepos = linemax - newlinelen.
            IF linepos > datalen.
            Enough space available in new table line for all of old table line
              newline+newlinelen = oldline.
              oldlinelen = STRLEN( oldline ).
              addspaces = datalen - oldlinelen.
              CONTINUE.
            ELSE.
            Fill up new table line
              newline+newlinelen(linepos) = oldline(linepos).
              ASSIGN newline TO .
              newrow = 'X'.
            Save the remainder of old table to the new table line
              IF linepos < datalen.
                oldlinelen = STRLEN( oldline ).
                addspaces = datalen - oldlinelen.
                CLEAR newline.
                newline = oldline+linepos.
              ELSE.
                CLEAR newline.
              ENDIF.
            ENDIF.
          ENDLOOP.
        Write the last line to the table
          IF newrow = 'X'.
            APPEND INITIAL LINE TO xdatatab ASSIGNING .
    Next I call FM 'CONVERT_RTF_TO_ITF' to get the document in SAPScript format:
        Convert the RTF format to SAPScript
          CALL FUNCTION 'CONVERT_RTF_TO_ITF'
            EXPORTING
              header            = dochead
              x_datatab         = xdatatab
              x_size            = xsize
            IMPORTING
              with_tab_e        = withtab
            TABLES
              itf_lines         = itf_table
            EXCEPTIONS
              invalid_tabletype = 1
              missing_size      = 2
              OTHERS            = 4.
    This returns the document still containing the mail merge fields which needs to be filled in:
          LOOP AT itf_table INTO itf_line.
            WHILE itf_line CS '«'.
              startpos = sy-fdpos + 1.
              IF itf_line CS '»'.
                tokenlength = sy-fdpos - startpos.
              ENDIF.
              token = itf_line+startpos(tokenlength).
              REPLACE '_' IN token WITH '-'.
              ASSIGN (token) TO .
              ENDIF.
              MODIFY itf_table FROM itf_line.
            ENDWHILE.
          ENDLOOP.
    And finally I use FM 'CONVERT_ITF_TO_ASCII' to convert the SAPScript to text. I set the line lengths to 60, since that's a good length to format emails to.
        Convert document to 60 char wide ascii document for emailing
          CALL FUNCTION 'CONVERT_ITF_TO_ASCII'
            EXPORTING
              formatwidth       = 60
            IMPORTING
              c_datatab         = asciidoctab
              x_size            = documentsize
            TABLES
              itf_lines         = itf_table
            EXCEPTIONS
              invalid_tabletype = 1
              OTHERS            = 2.
    And then the text document gets passed to FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' as the email body.

Maybe you are looking for