Documentation for Word 2010 OLE on powerbuilder - ole

Powerbuilder application used Word 2003 so far, Now we have decided to move to Word 2010.But I couldn't find the proper documentation for Word OLE for powerbuilder.

I have experienced with accessing ole(mostly excel and one word ole) from Powerbuilder but I cannot post my code here because it is my company own ( event I built it).
I give you clue:
Create macro in Word.
See the code in VBA.
if there is constant var, please open vba browser to see original value , it can be numeric or int or string.
Look Powerbuilder documentation Ole ( connecttonewobject instead of connectoobject).
Create the code what ever you want, search in the internet Powerbuilder ole
close the connection ole... quit (word ole) and (destroy ole_name).
that's all, sorry cannot shared my code, that's from experience searching via Internet.

Related

DOORS: Insert OLE with explicit type (aka Show PDF as editable information)

I can insert MS Word files as OLE into a DOORS object, both manually and via DXL, but PDFs (and EPS as well) behave different: it is difficult to make those not appear as icon.
I able to insert a PDF file (showing some graphics) as OLE manually only by using the dialogue's Create New radio button with specifying the type explicitly as Adobe Acrobat Document (without the Display As Icon option). All is well in this case.
Using the radio button Create from File button leads to the same undesired behaviour as using the DXL function insertOle() to insert the object: the result is displayed as icon only.
if (oleInsert(current, "c:\\temp\\27.pdf", false))
print "Successfully embedded document\n"
else
print "Problem trying to embed document\n"
Gives me:
Double-clicking the icon opens the associated application (Acrobat Reader) and shows the embedded PDF properly. However, the OLE properties dialogue displays the type Package. Manual insertion as described above creates an OLE object with the type Adobe Acrobat Document (as specified while creating it).
Inserting a Word document via DXL instead of the PDF makes the embedded document being rendered properly -- apparently the type is determined automatically and correctly:
Apparently, I am not able to (but would have to) specify the OLE type when inserting the PDF.
I am aware of a similar problem at the IBM forum, but the code from there did not even update existing OLE objects but left my objects without any OLE content! Another thread addresses that problem too, but does not provide a detailed solution.
There are two things I would check that would cause a different result for you and your colleague:
Check if they have a full 'edit' version of Adobe Acrobat installed. Since OLE is a Microsoft standard, having Full Acrobat instead of just the Viewer installed may register components with Windows that allow the OLE to display properly for them.
If they do not have Full Acrobat installed, then perhaps they have a different version of the Viewer or a 3rd party PDF viewer that you do not have on your machine.
The DXL reference manual specifically states that An OLE package is created if a file has no associated applications that support OLE. So your system is not recognizing the association, but your colleague's is.
The root cause is still unknown, but the problem was solved eventually. My Windows user account was deleted and created from the scratch. Now it works.
Another colleague has the same problem -- maybe we will take the time and try to isolate file / setting which contained the cause.

count words in word file that was uploaded

is there a way so i can count the words in a word file (all versions) in classic asp or asp.net?
what i need is to know how many words and if possible to make an array of word length and how many from each so words of 1,2,3 letters will get less attention from the code later.
i was thinking of using FSO or something like that but that won't work for docx
i can upload the file with aspupload or any other object if needed. if there is an object that can be bought that will upload and count words i don't have a problem purchasing it
thanks in advance
You have several options -
If you can have office installed on the server and don't require this to be an fast solution, you can try Word Interop. See Word count using Microsoft.Office.Interop.Word. A similar option is to have OpenOffice installed and work with that, never did that myself.
You can use the IFilter interface (http://msdn.microsoft.com/en-us/library/ms691105(v=vs.85).aspx). Microsoft already implemented logic to take Word files and give you access to the inner text, so all you'll have to do is count the words. Look at the first answer here Are IFilters necessary to index full text documents using Lucene.NET and the link it provides or How to extract text from MS office documents in C#. You can also look at http://blogs.msdn.com/b/jasonz/archive/2009/08/31/sample-parsing-content-in-c-using-ifilter.aspx
You can use 3rd party tools, I know there are some out there, but I'm not really familiar with any of them. For example see http://www.aspose.com/.net/word-component.aspx
If you don't really need support for ALL word versions, then there are various ways to work with Word 2007+ files - for example - the official openXML or the open source docx
Option (2) seems like the way to go to me.

Converting page contents into MS word in C# ASP.net

I have stored page contents (tables, plain text, images and paragraphs) into a variable. Now i want to convert this variable contents into MS word. How i can do this. Is there any possibility available in VS2010? OR is there any free library available for this conversion?
If you already have everything stored somewhere.. you can do something like Building a Word Document Using SQL Server Data
Moreover, there is a good example about Microsoft Word Documents from ASP.NET

how to automate word document creation in office 2010

The intranet website is supposed to create a word document client-side from templates
server-side and let the client edit it.
The code that worked in office 2007 doesn't work any more and I can't find any way to do it on google.
I used this code lines which was the only code i did find in google and still nothing
dim appWord
set appWord = New Word.Application
can anyone tell me how to create a word app object that works with word 2010.
thx in advance.
Edit: I need the object to be able to takes parts from various word documents and copy paste them into a single document in a certain formation
You can use the open xml sdk to create and edit office documents, see: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5124
Although the download page says office 2007, it works for 2010 as well.

Replace text in Word Document via ASP.NET

How can I replace a string/word in a Word Document via ASP.NET? I just need to replace a couple words in the document, so I would like to stay AWAY from 3rd party plugins & interop. I would like to do this by opening the file and replacing the text.
The following attempts were made:
I created a StreamReader and Writer to read the file but I think that I am reading and writing in the wrong format. I think that Word Documents are stored in binary?? If word documents are binary, how would I read and write the file in binary?
Dim template As String = Request.MapPath("documentName.doc")
If File.Exists(template) Then
Dim sr As New StreamReader(template)
Dim content As String = sr.ReadToEnd()
sr.Close()
Dim sw As New StreamWriter(template)
content = content.Replace("# T O D A Y S D A T E", Date.Now.ToString("MM/dd/yyyy"))
sw.Write(content)
sw.Close()
Else
Word binary format is proprietary to Microsoft. The specification to read the binary format is complex and will take you ages to learn about the document structure and the internal bit and byte structure. I really dont think you will save yourself anytime going down this path, so consider the below:
Use Open XML
Automate Word
Use third party library like Aspose
Use RTF rather than Doc. You can then look for specific RTF tag with your text and replace it with another set of RTF text block. This is probably the simplest for what you want to do if RTF is an acceptable format.
Personal experience, automating Word isn't as bad as it sounds. It is really not suitable for server high volume environment, but for smaller load, it works well of course if you write your code well to manage the application object and handling exceptions.
EDITED: Corrected about my initial NDA comment mentioned. This was the case when I worked on this back in 2005/6 and didnt realize Microsoft had decided to publish that in the recent year.
Lots of choices:
Some of them expensive (Apose)
Some of them hard (binary formats)
Some of them require Interop (VSTO)
or newer formats (Open XML)
Some of them not mentioned yet, like
running Word on the server and just
writing to that (not recommended by
MSFT, but probably your only real
choice for a) cheap, b) simple
OfficeWriter.
If word documents are binary, how would I read and write the file in binary?
They are, and that's why you should use a third party library to program against them.
I would like to stay AWAY from 3rd party plugins & interop
This requirement makes the task extremely hard. If your documents are in the "old Word format" (.doc), I will almost say that you are out of luck. If you can use Word 2007 documents (.docx) instead, you should be able to solve the problem by unzipping the file (it's essentially a ZIP archive), do search/replace in contained XML files and zip the document up again.
See also: Generating a Word Document with C#
You could perform Word automation on the server to easily do it, but that route is fraught with danger. Automation is not designed to run server side and you will find it regularly hangs when Word pop's up a prompt or confirmation box waiting for input that nobody can see.
You have to make a trade off, use Word automation and accept it may hang pretty regularly (anything from daily to weekly), or buy a third party solution. I use Aspose and it has solved a lot of problems.

Resources