Embedding objects into Microsoft Word and OpenOffice Writer [closed] - com

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I am looking for some references on how to implement the following feature:
ability to embed objects (e.g. diagrams) into word processors and being able to edit them in their respective "mother" application
For example, MS Word and Visio work like this together, allowing the user to easily edit/tweak the diagrams after adding them to the word processor.
I am interested in how this is done on the following platforms:
Microsoft Word
OpenOffice
So far I know that:
Microsoft Word uses OLE/COM
Open Office uses UNO
Can you point me to any references, examples, books on how to approach this?

Since OLE is an almost pre-historic technology (still of use) you have to dig a bit deeper in MSDN. The article linked below describes a sample application that can be embedded into container applications such as IE, Word, or OpenOffice. The sample is based on VC6, so I don't know how much luck you will have to get it running with current versions of Visual Studio.
Creating an OLE Server
Probably the most simple option to create an OLE control (.ocx) is to use the old Visual Basic 6. This is described here:
How To Create and Use a Minimal ActiveX Component in VB
It is also possible to write a control in managed code like C#, but I assume this is not recommended1 as it might lead to conflicts if the current process is already running another version of the CLR (Up to now, only one version of the CLR can exist in a process, .NET 4.0 will introduce side-by-side execution of the CLR). I found the following tutorial:
Create ActiveX in .NET Step by Step
1See the warning at the bottom of this article by Andrew Whitechapel.

This can still be quite easily done in Word using COM (or OLE but it's the same thing with a new name). Depending on what language you are intending to do it in you will go about it differently. Essentially you need to create a particular kind of ActiveX control.
In Delphi (the easiest language to do this in) you would create an ActiveXForm in a COM dll and then you would be able to embed this in your word document. You could make your application do whatever you wanted inside Word (talking to Word is a bit more involved but possible).
I have no idea what to do in OpenOffice I'm afraid.
I think you need to come back with more specific questions.

Related

Should i go with vb.net or VBA? Mostly working with excel files [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm starting a new job - my first - as a financial controller. The job will mean working a lot with excel files, for example formatting a document so that it can be imported and understood by other financial programs like SAP, or creating charts with the data in a document. There might be many specific tasks where vb.net/vba can come useful so I would really to be good at it.
My question is, should I do vb.net through visual studio or vba via Excel? My understanding is that you can achieve basically the same things with both in terms of excel-files, but perhaps vba is quicker and easier to learn and use. Vb.net on the other hand has a much better IDE through visual studio and learning it will give me a knowledge which can also be more useful elsewhere. Is this correct? Instead of trying one of them only to find out after some time that I should have gone with the other, I hope to get it right from the start.
I use both VBA and VB.Net so I would recommend learning both.
Learning VBA is easier than learning VB.Net because there is so much less to learn. I find VBA tutorials easier to master mainly because most VB.Net tutorials seem to be more concerned with demonstrating the amazing functionality of VB.net than teaching you the basics of the language. Once you have VBA under your belt the learning curve to VB.Net is not too steep.
You access Excel workbooks from VB.Net using an interop which can read and write from any Excel version from 2003 onwards. It may be able to access earlier versions but I do not know any one who uses earlier versions so cannot test. The interop is slow. If your program is doing nothing but manipulate Excel worksheets, you are probably better using VBA.
VB.Net's forms have far more controls than VBA's. If you are trying to create an attractive, flexible, adjustable user interface then VB.Net is the one to choose.
VB.Net is compiled to an immediate language which is then compiled to machine code at runtime to take advantage of the capabilities of the machine it is running on. VBA compiles to an immediate language which is interpreted at runtime. For heavy processing, VB.Net programs can be thousands of time faster than VBA macros.
VB.Net creates executable programs (MyProgram.exe) which can run on any Windows machine making them easy to distribute if necessary. VBA macros run within Excel so the user need to have and open Excel to run them.
To summarise: start with VBA but then try VB.Net once you have mastered the syntax.
Incorrect. VBA is far faster has it runs in process. All calls are marshalled into network protocols to be sent cross process.
Plus you have to load COM with VBA. To use Excel you have to load COM. To use VB.NET with Excel you load COM and .NET - a far bigger resource load.
The code would be almost identical.

Visual Documentation in IDE [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I regularly get frustrated by text-overload in my IDE (Eclipse right now). I find myself separating my methods by big chunks of whitespace, and then regretting that later when I need to find something by scanning through the code.
Something I think does work well is the GrepCode way of viewing source code. Does anyone know if anything like this has been implemented in a code editor? More specifically, I want the ability to have nice, formatted and colourful documentation (preferably collapsable) to help me read my code. It could even have the ability to embed design images.
"Text-overload" is precisely why a plugin like Mylyn does exist.
Mylyn's task-focused interface reduces information overload and makes multitasking easy.
Mylyn makes tasks a first class part of the IDE, integrates rich and offline editing for ALM tools, and monitors your programming activity to create a "task context" that focuses your workspace and automatically links all relevant artifacts to the task-at-hand.
This puts the information you need at your fingertips and improves productivity by reducing information overload, facilitating multitasking and easing the sharing of expertise.
Plus you can add to your project WikiText, with Markdown support (see WikiText FAQ, and its User Guide)
To better manage huge amounts of code, you may want to reconsider these:
Use Eclipse Mylyn, as it will hide code that you don't work with.
Open Windows -> Preferences, type "Folding" in the preferences dialog
and check, which editors should provide more folding by default to
hide non relevant things from you.
Have a look at the Java browsing
perspective of Eclipse. It stems from the old Smalltalk code browsing
user interfaces and is meant to more easily manage (but not edit)
Java code.
If you are working much visually with your code (and remember its layout instead of the structure), you may find the Crazy Outline view very helpful. It provides an airplane layout view of your text.
If the more important aspect of your question is how to more easily see the documentation you wrote for your code, check this:
Make sure that the JavaDoc view and the Declaraction view are opened and visible all the time to show Javadoc and declaration of whatever your cursor points at. Make sure you actually provide JavaDoc comments, to begin with.
The Eclipse Code Recommenders project has advanced documentation views, which basically show the results of data mining of common Eclipse code. You can get a company internal (commercial) version of that tool, so it would recommend code completion, as other code in your projects was written.

Do you program in Linux and document in Windows? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Most offices today use Microsoft Office for documentation and presentation. Lots of programmers prefer to work and develop under Linux. When your shop uses both, how do you do your development in Linux and documentation in Windows and stay productive?
I would just do the documentation in Linux too. MS Office can be run using some Wine derivative (or so I'm told), but I would rather use OpenOffice.org for such documents.
If you absolutely have to use Windows, you can boot a virtual machine (using e.g. VirtualBox) and do the dirty work while still having access to your preferred environment.
The teams I've been with always write documentation in Linux. POD makes it very easy to write tolerable-looking man pages, and higher-level ("glossy") documentation can be done with simple tools (HTML), moderate-complexity tools (markdown) or with very complex tools (LaTeX).
To each their own, but I'd avoid the Office and OpenOffice tools like a skunk, because they play so poorly with git, svn, cvs, etc. (diff, blame, merge, etc., just don't work with a big binary pile of data.)
There are two options that I've seen used.
(1) Use web-based documentation. Examples include Google Docs or a wiki. As long as you have a web browser, you can view and edit the documentation.
(2) Use a cross-platform office suite. I have OpenOffice.org installed on Linux and it can open Microsoft Office file formats, including the new .*X format. The only thing that you need to do is to make sure that you open it in a Microsoft product later to make sure the formatting is still good.
But everyplace that I've personally worked performed cross-platform development. In these cases, the development machines were typically Windows boxes and the developers either ran Linux VMs or SSH'ed into a Linux server to test their work on the deployment environment.
Steve Streeting wrote an interesting blog post about his technical documentation tool chain with the following requirements:
Lets the author concentrate on content rather than style
Generates multiple formats from one source (HTML, PDF, man pages, HTML Help etc)
Does all the tedious work for you such as TOCs, cross-references, source code highlighting, footnotes
Is friendly to source control systems & diffs in general
Standard enough that you could submit the content to a publisher if you wanted to
Preferably cross-platform, standards-based and not oriented to any particular language or technology

Options for automating Microsoft Word 2007 document creation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have automated word document creation from templates using the "Microsoft Word 12.0 Object Library" in my project, but it is unacceptably slow. I'm looking for alternatives: I need to create a document from a template, run some macros and insert text and tables into various bookmark ranges (some text formatting options would be nice too). I only need the final document to be compatible with Word2007, but would prefer a solution easily available from .NET (other recommendations are appreciated too)...
Please advise.
Have a look at Microsoft's Office OpenXML SDK. It allows you to create Word 2007 (.docx) documents programmatically without the Office applications.
To use it you will need to be familiar with the OpenXML file format. A good starting point also providing examples are the blogs of Brian Jones and Erika Ehrli.
This sample on CodeProject might also be a good start: Creation of a Word 2007 document using the Open XML Format SDK.
I also recommend you to have a look at the DocumentReflector, a tool included within the SDK, that creates the code to produce a certain Word document based on an existing document.
Options, I used up to now:
Yours - COM automation: performance wasn't the biggest issue here for me,
just all the ugly details of COM automation like dead processes, locked files, ...;
for some tasks where an API exists and as long as only person uses the app,
its still an option.
Requires Word installation.
Import as HTML and save as Word - works quick and better as expected,
as long as your word format is simple and matches HTML markup structure quite well
(e.g. headers, item lists). To simplify handling, templates have to be HTML then,
so often a quick hack for a limited use case.
Requires Word installation.
Concatenate and process templates saved as WordML: saves you the pain of COM
automation, but since WordML is just a binary format masked as XML, it's often a pain;
hence some tasks are more complicated than using a Word-API.
Nevertheless I prefer it over 1.
Does not require a Word installation.
As in previous answer, OpenXML SDK: just starting to use this, seems to be a good
compromise of 1 and 3: work on XML level or on API level - whatever fits best for a
certain feature.
Does not require a Word installation.
other recommendations are appreciated too
The Java equivalents to the OpenXML SDK are docx4j (my project), and POI.
Using docx4j, you can inject macros into an existing docx, or work from a dotm (as divo suggests).
Officewriter is another option.
The OfficeWriter API is a .NET library that allows you to generate,
manipulate, and read Excel and Word documents from your own
applications.

Alternative IDE for VB6 and VBA [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I've been spoiled by Visual studio 2008 and Eclipse and have to do a little maintainence work on a VB6 app.
Does anyone know of an alternative/ updated IDE for VB6?
A rewrite is not an option I'm just fixing a couple of bugs and it's a big codebase.
I have never heard of an alternative IDE for Vb6. However, these two (free) VB6 add-ins are indispensable and will make your life easier - especially if there is a lot of code. They are equally effective for VBA in Microsoft Office.
MZ-Tools: provides a superb collection of IDE tools - finding unused variables, unused methods, a great "search all", code snippets. Written by Carlos J. Quintero, to whom I now owe hours and hours of time.
http://www.mztools.com/v3/mztools3.aspx
And SmartIndenter, which takes care of all the auto-indenting. It does one thing and it does it well.
http://www.oaltd.co.uk/Indenter/Default.htm
Some time ago I did some research and nothing came up. I don't believe you have have any real alternatives...
But you could consider checking this out:
http://www.axtools.com/products/cs2k3vb_screenshots.htm
It looks quite promising.
Addin for Visual Basic 6.0 packing more than 50 professional tools and
assistants. The Code View Assistant
enriches the standard VB6 code editor
with branch lines for conditional
statements, end-of-line details, and
hotspots. Moreover, the Code Analyzer
pinpoints dead and slow code, the
SmartComplete and AutoText tools help
you write code with a proficiency you
never dreamed of, while the Enhanced
Project Explorer with expanding code
and Code Flow View can make accessing
a code location the speedy action you
always needed. Other tools: Extended
Find, Find References, Designer
Explorer, Code Formatter, TabOrder
Designer (with auto-order), HotKey
Designer, Error Handlers Inserter,
Exception Protection, Spelling
Checker, Strings Reviewer, Comments
Conformity Checker, Task List Manager,
Code Snippets Manager, Naming
Standards Manager.Version 2007 adds
Designer Analyzer, User Interface
Standard Properties Manager, Library
Explorer including Designer Snippets,
many enhancements in most subsystems.
Because the VB6 IDE does not detect file changes made outside of the IDE, it can be quite difficult to develop code outside of the VB6 IDE, without running the risk of loosing code changes.
But it is possible to run a VB6 project build from the command line so it is possible to do simple VB development using any text editor/IDE capable of running a command an capture it's output.
But for things like GUI changes and debugging there is really no choice but to revert back to the VB6 IDE.
Here is the commands needed to run the build from the DOS prompt:
set PATH="d:\Program Files\Microsoft Visual Studio\VB98\";%PATH%
vb6.exe /out ErrorFile.txt /make MyProject.vbp
FWIW the Zeus IDE has the ability to import a VB Project file and display the project details into project/workspace tree. It will also run the build an capture the output.
Visual Basic Tools For Visual Studio lets you open vb6 project in visual studio 2012/2013, with basic outlining, syntax coloring, and a few more things.
Its a work in progress, but if like me you have some living dead vb6 programs to maintain, it's... intriguing.
Except there's no GUI editor, no debugging. I fear these points (especially debugging) are deal breakers. (Of course, I understand that not everything is possible).
Yeah, no alternative IDEs to VB6 afaik. But one indispensable add-in I used was CodeHelp. It gives you tabs! for the windows, easy tab ordering, fullscreen switcher and maybe a mousewheel add-in. Check it out from the Planet Source Code page. And be sure to check the comments for a download to a setup file as I had problems with the source code and the author's site.
CodeHelp Add-In 2.2 Amazing VB6 plugin to help organize and coding.
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=62468&lngWId=1
I used Visual Assist X while programming in VB6. It's a code coloring add-in.
A must have, once you got used to VS2005+
I don't know if VB6 is still supported in current version, so you should take a look and see for yourself (and perhaps get an older version)
DoyleSoft BASIC alternative visual basic
jabaco compiler too-