MS Word automation with java
hi
our customer wants to be able to start a word document out of a java application (to write a letter...) and to fill in some variables, like the address, also out of the java application...
anybody has an idea how to implement that ?
thanks, domenico
Take a look at IBM's bridge2java
http://www.alphaworks.ibm.com/tech/bridge2java/
Similar Messages
-
Create Word document with Java
I want to create a Word Document with Java. But I don't know how can I insert text in a Word document.
I searched and found JXWord (probably limited to Windows): http://www.geocities.com/picmapicma/
I'm interrested to know if it works fine...:) -
Api POI read and replace my word document with java
Hi
Everyone
I�d like to know if someone has a piece of code reading a word document with api POI to send me?
I need read replace the word document wiht java j2ee.
ThanksHello,
You have to use the Office Integration Library. Please, follow the documentation below:
http://help.sap.com/saphelp_nw04/helpdata/en/c3/32853febec3c17e10000000a114084/frameset.htm
I hope this helps you.
Regards,
Blanca -
Flagging Word documents with Java???
Hi everyone!
We are currently designing an Intranet architecture in J2EE and are looking for a solution to the following problem:
We are going to create a Word template which all users submitting a document must use in order for this to be accepted. The reasoning behind this is that we are using a pubishing package to convert all documents into HTML and we need to ensure consistent formatting. The problem is how do we ensure that this template is used? What we want to do is somehow 'flag' the original template and allow the framework to check whether the document submitted is flagged (i.e. used the original template). So i guess the question i'm asking here is does anyone know how we might go about this? Is Java able to read Word documents in their native format?
Many thanks for your help in advanceSeems to me that regardless of whether they started with the template or not, they are free to completely change the contents so that it wouldn't resemble the template in the end. So even if you could determine that, it doesn't seem worth anything.
-
Is using Excel through Automation with Java possible ?
Hi, I'm currently a Visual Basic developper thinking of moving to a java based RAD technology.
For a couple projects, I need to generate Excel Spreadsheets and present them to the user. I usually do this in VB by using the COM object provided by Excel, instancing it and using the Range([cellname]).value property to write data in the sheet.
Is their any way to do a similar thing in Java, or does this level of comfort come solely by using a Microsoft developpement product (thus more integrated with office) ?
Thanks in advance.1. Writing java functions in MS Visual J++ 6.0, instead of in MS VB, and then compiling as a COM function has been the only way I've been able to mix the convenience of spreadsheet IO (alas, still in Excel) with the powerful functions we can write in Java.
2. It's ironic java programmers must still build IO interfaces in their IDEs every time they want to write & use a new java function, while MS has made user-written VB functions available to all Excel users (even to MS Word users). Last time I looked, the Star Office speadsheet only allows writing functions in ersatz VB (Sun Basic) instead of in Java.
3. To Sun: Please make java available to the masses by giving us a spreadsheet that runs user-written java functions. The spreadsheet is the most powerful programming paradigm around. Remember when Lotus made a zillion $? You can make more money from Gates's vision than by imitating his products.
- Bill Ellis [email protected] -
Can i create & use ms-word files with java?
I am making an application in which I need to write some information into a formatted ms word document. I am familiar with writing into a .txt file, but have no idea how to create / or even add info taken from text fields and insert it into an exixting word file. If anyone has any ideas or code frags I would really appreciate the help. Thanks
Provided that you are on a Windows machine and that Word is installed, you can manipulate an instance of the MSWord ActiveX control to create documents (that's how we do it). See:
http://danadler.com/jacob/ -
Generating reports in .doc format (Word Document) using Java POI - HWPF
Hi
Can anybody help me how to generate the report in .doc format using POI API?
Please share the sample code, if you have.
Thanks in Advance
DhilipHi,
I dont think that your requirement has to do with ADF capabilities.
You want to edit a word document with JAVA. For that reason, you will need an API, as the suggestions above.
You can do it without ADF and by using standard JAVA and the API of your choice. a static void main will do for that matter.
ADF comes into the game when you want to handle the document with your ADF application.
This means that you either want to get your new data to be placed on your doc from BC or any other DataControl or you want to do something else with ADF..
My guess is that you want to get data from ADF into your Doc.
You could create an API on handling your Doc and then use it into your ADF application.
Regards,
Dimitris. -
Convert dotx or docx to pdf with Word Automation Service failed
Hello everybody,
After search on the internet, I'm looking for a solution to this issue.
I wrote this code for a document conversion in a visual studio 2010 workflow:
string wordAutomationServiceName = "Word Automation Service";
ConversionJobSettings jobSettings = new ConversionJobSettings();
jobSettings.OutputFormat = SaveFormat.PDF;
ConversionJob job = new ConversionJob(wordAutomationServiceName, jobSettings);
job.UserToken = workflowProperties.Site.UserToken;
job.AddFile(workflowProperties.WebUrl + "/" + file.Url,
workflowProperties.WebUrl + "/" + file.Url.Replace(".docx", ".pdf"));
job.Start();
URLs are corrects and the word document exists.
The problem is when the job is executed, I have errors in SharePoint logs:
11/18/2011 09:24:15.87 w3wp.exe (0x1BC4) 0x1CA0 Word Automation Services
Office Viewing Architecture 9rte Medium Request received for document 00000001-0001-10e2-80af-d08c970b9892, format: , numberInQueue: 0, request id ba03fb58-55b2-4c6c-b1ca-20fad3b11585
00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.87 w3wp.exe (0x1BC4) 0x1CA0 Word Automation Services
Office Viewing Architecture c7ld Medium AppManager.BeginProcessRequest adding request to queue 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.88 w3wp.exe (0x1BC4) 0x1CA0 Word Automation Services
Timer Job g27p Medium Local Controller '71cf62b9-c34c-46c4-9828-55de2d5f5ac0':
In Progress: <http://site/Contracts/docsettest/contracttest.dotx> downloaded and queued locally 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.88 w3wp.exe (0x1BC4) 0x17C0 Word Automation Services
Configuration g6xc Medium Item 00000001-0001-10e2-80af-d08c970b9892: Assigned to
local worker process: 1D64 (7524; worker id = cce33245-48b9-4b0d-afcd-e3218845d81a) 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.88 w3wp.exe (0x1BC4) 0x1CA0 SharePoint Foundation
Monitoring b4ly Medium Leaving Monitored Scope (ExecuteWcfServerOperation).
Execution Time=23.6994391735768 2fd2393d-f36d-49a1-bfdf-737aefc8659a
11/18/2011 09:24:15.88 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture vipp Medium AppWorker:cce33245-48b9-4b0d-afcd-e3218845d81a initializing for request ba03fb58-55b2-4c6c-b1ca-20fad3b11585
00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.88 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture vipr Monitorable AppWorker:cce33245-48b9-4b0d-afcd-e3218845d81a worker call failed System.ServiceModel.CommunicationObjectAbortedException: The
communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it has been Aborted. Server stack trace: at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen()
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Re...
00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.88* w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture vipr Monitorable ...moting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) at Microsoft.Office.Web.Conversion.Framework.Remoting.IAppChannelCallback.Initialize(WorkerRequest request, FileItem fileItem) at Microsoft.Office.Web.Conversion.Framework.AppWorker.ProcessRequest(ConversionRequest
request). Worker name WordAutomationServices, Document 00000001-0001-10e2-80af-d08c970b9892 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.88 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Service g281 Medium Local Controller '71cf62b9-c34c-46c4-9828-55de2d5f5ac0':
Failure: <http://site/Contracts/docsettest/contracttest.dotx> not uploaded to <http://site/Contracts/docsettest/contracttest.pdf> (65543) 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.90 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture c78j Unexpected AppWorker:cce33245-48b9-4b0d-afcd-e3218845d81a ProcessRequestDone() received error response WorkerException, restarting the worker
00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.90 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture b1qa Medium Shutting down process with force processId: 7524 belonging to AppWorker cce33245-48b9-4b0d-afcd-e3218845d81a
00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.91 w3wp.exe (0x1BC4) 0x1CA0 Word Automation Services
Configuration g6xb Medium Local Controller '71cf62b9-c34c-46c4-9828-55de2d5f5ac0':
Local worker process exited: 1D64 (7524); exit time = 11/18/2011 09:24:15
11/18/2011 09:24:15.91 w3wp.exe (0x1BC4) 0x1CA0 Word Automation Services
Configuration d0md Medium App 'Word Automation Service': Deleting temp directory
'C:\Windows\TEMP\wdsrv\21659d2e-c634-46a2-9585-b4cd1398f64c\odsibdmm.cmv\1D64'
11/18/2011 09:24:15.92 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture xpre Medium Removing worker cce33245-48b9-4b0d-afcd-e3218845d81a, thread: 216 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.92 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture f2yg Medium CreateSandBoxedProcessWorker() is called 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture b10e Medium Created desktop: Service-0x0-3eaf55d$\Microsoft Office Isolated Environment 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture 2brt Medium AppWorker:89d80fff-43ec-459e-9d95-5ed8b67f20bb worker process is started Exe: WordServerWorker.exe Args: /id 89d80fff-43ec-459e-9d95-5ed8b67f20bb
/convertingService net.pipe://127.0.0.1/WordServer71cf62b9-c34c-46c4-9828-55de2d5f5ac0 /assembly WdsrvWorker.dll /type WACWS /IsBatchedTracing True /LogQuota 100 WorkerType: WorkerType1 Directory: c:\windows\system32\inetsrv, pid : 3700, IsSandBoxed: True,
UniqueSandBoxSid: S-1-5-26473-19571-45394-48 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture vioz Medium RemoveWorker isRemoved: True session id : uuid:c9cce13b-5285-47d6-a666-29da19e57c67;id=47, Guid: cce33245-48b9-4b0d-afcd-e3218845d81a
00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture b4em Monitorable AppWorker:cce33245-48b9-4b0d-afcd-e3218845d81a recycle worker process because the conversion failed with result WorkerException.
Worker is WordAutomationServices 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture xpre Medium Removing worker cce33245-48b9-4b0d-afcd-e3218845d81a, thread: 216 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture vioz Medium RemoveWorker isRemoved: False session id : uuid:c9cce13b-5285-47d6-a666-29da19e57c67;id=47, Guid: cce33245-48b9-4b0d-afcd-e3218845d81a
00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x211C Word Automation Services
Office Viewing Architecture a2oj Medium PreProcessTime = 0; InConversionQueueTime = 0.0019142; ResponseTime = 0.0066997; TotalConversionTime = 0.0535976; AvgPreProcessTime
= 0; AvgInConversionQueueTime = 0; AvgResponseTime = 0; AvgTotalConversionTime = 0; historyCount = 0; result = WorkerException; format = n/a 00000001-0001-10e2-80af-d08c970b9892
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x144C Word Automation Services
Office Viewing Architecture 4sig Medium ChildProcess WordServerWorker.exe is launched inside worker 89d80fff-43ec-459e-9d95-5ed8b67f20bb. Pid 3700
11/18/2011 09:24:15.93 w3wp.exe (0x1BC4) 0x144C Word Automation Services
Office Viewing Architecture d9hn Medium NotifyNewChildProcessInWorker has seen WordServerWorker.exe in worker 89d80fff-43ec-459e-9d95-5ed8b67f20bb
11/18/2011 09:24:16.45 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture viou Medium ... registering worker 89d80fff-43ec-459e-9d95-5ed8b67f20bb
11/18/2011 09:24:16.48 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture viox Medium Worker 89d80fff-43ec-459e-9d95-5ed8b67f20bb is now initialized.
11/18/2011 09:24:16.55 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture vipx Monitorable AppWorker:89d80fff-43ec-459e-9d95-5ed8b67f20bb application server host exited unexpectedly (thread: 6)
11/18/2011 09:24:16.55 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture c78j Unexpected AppWorker:89d80fff-43ec-459e-9d95-5ed8b67f20bb ProcessRequestDone() received error response WorkerCrashed, restarting the worker
11/18/2011 09:24:16.57 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture xpre Medium Removing worker 89d80fff-43ec-459e-9d95-5ed8b67f20bb, thread: 6
11/18/2011 09:24:16.57 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture f2yg Medium CreateSandBoxedProcessWorker() is called
11/18/2011 09:24:16.57 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture b10e Medium Created desktop: Service-0x0-3eb1722$\Microsoft Office Isolated Environment
11/18/2011 09:24:16.57 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture 2brt Medium AppWorker:59168d75-7086-4318-8d12-633affa7b783 worker process is started Exe: WordServerWorker.exe Args: /id 59168d75-7086-4318-8d12-633affa7b783
/convertingService net.pipe://127.0.0.1/WordServer71cf62b9-c34c-46c4-9828-55de2d5f5ac0 /assembly WdsrvWorker.dll /type WACWS /IsBatchedTracing True /LogQuota 100 WorkerType: WorkerType1 Directory: c:\windows\system32\inetsrv, pid : 6752, IsSandBoxed: True,
UniqueSandBoxSid: S-1-5-26473-19571-45394-49
11/18/2011 09:24:16.57 w3wp.exe (0x1BC4) 0x18CC Word Automation Services
Office Viewing Architecture vioz Medium RemoveWorker isRemoved: True session id : uuid:c9cce13b-5285-47d6-a666-29da19e57c67;id=48, Guid: 89d80fff-43ec-459e-9d95-5ed8b67f20bb
11/18/2011 09:24:16.57 w3wp.exe (0x1BC4) 0x144C Word Automation Services
Office Viewing Architecture 4sig Medium ChildProcess WordServerWorker.exe is launched inside worker 59168d75-7086-4318-8d12-633affa7b783. Pid 6752
11/18/2011 09:24:16.57 w3wp.exe (0x1BC4) 0x144C Word Automation Services
Office Viewing Architecture d9hn Medium NotifyNewChildProcessInWorker has seen WordServerWorker.exe in worker 59168d75-7086-4318-8d12-633affa7b783
11/18/2011 09:24:17.10 w3wp.exe (0x1BC4) 0x1CA0 Word Automation Services
Office Viewing Architecture viou Medium ... registering worker 59168d75-7086-4318-8d12-633affa7b783
11/18/2011 09:24:17.13 w3wp.exe (0x1BC4) 0x1CA0 Word Automation Services
Office Viewing Architecture viox Medium Worker 59168d75-7086-4318-8d12-633affa7b783 is now initialized.
Thank you for your help.Hi Jean,
Were you able to resolve this? I am coming across the exact same error on a SharePoint 2010 development machine. I don't see any other posts on the web about it. Here is the entry from my ULS logs:
Local Controller 'fc8b8704-f0f1-4e85-a69a-dc5686c27e39': Failure: <http://ip-0a6ee272/Shared%20Documents/Word/hello.docx> not uploaded to <http://ip-0a6ee272/Shared%20Documents/PDF/hello.pdf>
(65543)
Do we share any of the following configuration points? I'm trying to narrow down the potential root cause ...
MSDN subscriber EXE install media "SharePoint Server 2010 with Service Pack 1 (x64) - (English)"
SP1 slipstream patch level. No cumulative updates.
http://autospinstaller.codeplex.com/ PowerShell scripted install
SQL 2008 R2 installed on same box as SharePoint
Active Directory domain controller on same box as SharePoint
c:\Windows\System32\drivers\etc\HOSTS file 127.0.0.1 entry for both machine and domain name
Thanks in advance for the research.
I've actually tried re-installing SharePoint several times on brand new virtual machines. That did not resolve the issue. Strangely enough, the RTM version of SharePoint appears to work just fine. With all other configuration points the
same, I loaded RTM ... ran a Word Automation PowerShell script ... and received the expected PDF output. Then when I apply the SP1 patch ... it stops working and I get error 65543.
Best,
@SPJeff -
How can I use Automator to open and save Word docs with links?
Hi-
I'm having trouble building a Workflow to open and save Word docs with links.
My Workflow so far:
1. Get Finder items
2. Copy Finder items (to new folder)
3. Rename selected items
4. Open selected items (Word docs)
Three problems occur.
The first is a Word 2004 problem -- I can't get the warning "This document has links in it; do you want to open it with/without updating the links" to go away (Unilke the Macro warning toggle capability, there is nothing in the Preferences for Word 2004 that addresses the links warning, as far as I can tell; any insight you can shed on this would be terrific.)
The second problem happens with Automator: if I manually accept the update of the first document's links, Automator opens that document but then halts completely, even though I've instructed it to open multiple documents.
The third problem I have is that there's no Finder action in Automator that allows me to save the document that's now open (as far as I can see).
Any suggestions for how to fix? If I can get this to work, and scheduled in iCal, it will be an unbelievable time saver.
Thanks,
Jeremy
PowerPC G5 Mac OS X (10.4.6)Hi there Jeremy,
to do this you are going to have to add in some Run AppleScript steps...
These will rely on GUI Scripting. So first you need to activate GUI Scripting.
Now we need to add in a Run AppleScript action to the end of your workflow...
This will replace your current number 4 in the workflow (Open Selected...)
click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">on run {input, parameters}
set allItems to every item of input
repeat with currItem in allItems
tell application "TextWrangler"
open currItem
end tell
activate application "TextWrangler"
tell application "System Events"
tell process "TextWrangler"
delay 2
--when the Word document is opened I have told it to press okay !
--I don't know what key you want it to press in the dialog box
keystroke return
delay 2
--save the doc
keystroke "s" using command down
delay 5
--close the doc
keystroke "w" using command down
end tell
end tell
end repeat
return input
end run</pre>
The above script should open each Word Document, press a button in the dialog box then do a save and then close the doc...then loop through the rest of them.
You need to replace the name Text Wrangler with Microsoft Word (or whatever it is called!), I don't have it on my Mac.
You will have to let me know what button needs pressing in the first dialog, if it isn't the 'highlighted ' one then we will have to amend the script...
regards
Ric -
Reading and displaying Ms.Word document with web dynpro java
Hi,
I'm using NetWever developer studio 7..0.21.
I'm developing web dynpro java application.I'm in difficulty to read and display word document with its original format in web dynpro view. Is it possible?
If possible , is there a blog etc.?
Thanks.Hello,
You have to use the Office Integration Library. Please, follow the documentation below:
http://help.sap.com/saphelp_nw04/helpdata/en/c3/32853febec3c17e10000000a114084/frameset.htm
I hope this helps you.
Regards,
Blanca -
Java Swing frame for modification Excel file or Word file with All menu...
Hello All,
Can Any one help me for making java Swing frame for modification Excel Data or word file with all Menu.. Plz send me java Code for that.. I am bit new in Swing.
i am waiting for ur help..
Thanks
Samirhi pbrockway2 ,
Can you go through this program Sir, i am trying to call Excel content below of menu. when i will press Edit button then excel content should come below with Cut, copy, paste , Save Button..
Plz help me sir...
import javax.swing.*;
import java.io.*;
import java.awt.event.*;
public class TestReader
private static void createAndShowUI()
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame=new JFrame("Test Reader");
JButton button=new JButton("Edit");
button.addActionListener(new ButtonListener());
frame.getContentPane().add(button);
frame.setVisible(true);
frame.pack();
static class ButtonListener implements ActionListener
public void actionPerformed(ActionEvent event)
openTheFile();
private static void openTheFile()
try
String commands[]=new String[3];
commands[0]="cmd.exe";
commands[1]="/C";
commands[2]="INSTALL.LOG"; // here file name is supposed to be in the working dir
Runtime rt=Runtime.getRuntime();
Process proc=rt.exec(commands);
StreamGobbler errorGobbler=new StreamGobbler(proc.getErrorStream(),"ERROR");
StreamGobbler outputGobbler=new StreamGobbler(proc.getInputStream(),"OUTPUT");
errorGobbler.start();
outputGobbler.start();
catch (Exception e){}
public static void main(String args[])
SwingUtilities.invokeLater(new Runnable()
public void run()
createAndShowUI();
static class StreamGobbler extends Thread
InputStream is;
String type,root;
StreamGobbler(InputStream is,String type)
this.is=is;
this.type=type;
public void run()
try
InputStreamReader isr=new InputStreamReader(is);
BufferedReader breader=new BufferedReader(isr);
String line=null;
while ((line=breader.readLine())!=null)
System.out.println(type+">"+line);
catch (Exception e)
System.out.println(e);
Thanks
SamiR -
Possible to Invoke MS Word with Java Application?
Is it possible to invoke Microsoft Word to open a word doc with a Java application?
If yes, what API or knowledge should I know to do this?
Please give some advice.Using the various forms of the exec() method in the Runtime class, you can execute arbitrary programs, such as MS Word. exec() returns a Process instance, which you can do various things with such as get input/output streams, kill, etc. Note the parameters to the exec() method are platform specific, because of differing command shell names, path separators, etc. So you will definitely have to experiment and see what works on your platform:
Process msWord = Runtime.getRuntime().exec( "cmd.exe /C winword.exe" );That is one of the general idioms for using exec(), like I say you will have to experiment to see what variant of exec() works for you. Try searching these forums, this question has been answered numerous times before. -
OLE Automation from Java (MS Word and Excel)
Hello,
I want to insert the data from my Java application into a MS Word document with bookmarks/fields that have to be filled, format the text, run a macro, save and print the document. Similar for MS Excel.
What I have gathered so far: The JavaBean-ActiveX bridge is for treating JavaBeans as ActiveX components, not the other way around. So I have to write native methods that access Word's COM - Component Object Model. Well, I don't "speak" C very well. I have found three commercial and one open source software that can do this:
- Java2Com by Neva Object Technology
- Jacob by Dan Adler
- J-Integra by Intrinsyc
- jacoZoom
Does anyone have experience with any of these and could tell me which ones are good and which ones are not so good? Or is there a completely different solution to doing this?
TIA,
Monika.hi all,
i've a similar situation. I store a word file containing word fields on a server. I would like to realize a merging between txt file containing datas and my word file, opening the result in word from a jsp. How can i do?
is it possible to realize the merge in java or is there a mean to launch ms word opening doc file and providing the txt file from jsp.
Thanx for help -
JSF webapp works with Java 1.4, but not Java EE 5
Hello
I am having a really weird problem with internationalizing my JavaServer Faces web application.
I am using Netbeans 6.0, Tomcat 6.0.10, JSF 1.2, and JTSL 1.1....
If I use Java 1.4 to run the webapp, everything works fine!
If I use Java EE 5 then it fails to execute internationalization of my choosen locale.
I could just use Java 1.4 and have my site working fine, but I would really like to use Java EE 5 since it can do more. Also I don't see why it can work on one version of Java but not another. My locales are English (en) and Korean (ko).
This is my index.jsp
<%--
Document : index
Created on : 2/05/2008, 01:33:01
Author : Steve
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<html>
<f:view locale="#{localeBean.language}">
<f:loadBundle basename="resources.messages" var="msg"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h2>Hello <h:outputText value="#{localeBean.country}"/>!</h2>
<br>
<h4><h:outputText value="#{msg.language}"/>:</h4>
<h:form id="languageForm">
<h:selectOneMenu onchange="this.form.submit();" valueChangeListener="#{localeBean.dropdown1_processValueChange}">
<f:selectItem itemLabel="English" itemValue="en"/>
<f:selectItem itemLabel="������" itemValue="ko"/>
</h:selectOneMenu>
</h:form>
<h:outputText value="#{localeBean.language}"/>
</body>
</f:view>
</html>This is my localeBean which is under the package "resources"
* To change this template, choose Tools | Templates
* and open the template in the editor.
package resources;
* @author Steve
import java.util.Locale;
import javax.faces.event.ValueChangeEvent;
public class localeBean {
private String language = Locale.getDefault().getLanguage();
private String country = Locale.getDefault().getCountry();
public String getLanguage() {
return language;
public void setLanguage(String newValue) {
language = newValue;
public String getCountry() {
return country;
public void setCountry(String newValue) {
country = newValue;
public void dropdown1_processValueChange(ValueChangeEvent vce) {
setLanguage((String) vce.getNewValue());
}This is my faces-config file
<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<application>
<locale-config>
<default-locale>en</default-locale>
<supported-locale>en</supported-locale>
<supported-locale>ko</supported-locale>
</locale-config>
<message-bundle> resources.messages </message-bundle>
</application>
<managed-bean>
<managed-bean-name>localeBean</managed-bean-name>
<managed-bean-class>resources.localeBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>and lastly I have my message bundle under the "resources" package which is named "messages".
This has a key word "language" which is "Language" in the 'en' locale file and "����" in the 'ko' locale file.
Once again when using Java 1.4 this project runs fine, however with Java EE 5 it does not.
You may notice in my index.jsp that I have <h:outputText value="#{localeBean.language}"/>
I use this to display the locale that has been chosen by my select box. Even when this shows a different language has been chosen the page does still not display in the correct language. According to <f:view locale="#{localeBean.language}"> then the locale of the page should be changed.
I have looked over the web quite far for an answer to this problem. But everyone else seems to be using a similar method of loading up a message bundle and using it the same way I am. However my method does not work.
Any suggestions or clues to what is going wrong would be really appreciated.
Thanks in advance^^it seems that the
<f:view locale="en">
only work if a ressource bundle with the locale sufix '_en' is provided.
Everything works now if I provide 3 ressouce files:
global_en.properties
global_de.properties
global.properties
global.properties and global_en.properties are identically!
But if I delete the global_en.properties file always the global_de.properties file wins before the default properties.
I did not expect such a behavior :-( -
Should we avoid Graphical mapping and stick with Java mapping?
After developing mappings in XI for a month, I just don't see any good reasons to use Graphical mappings over Java mappings. Maybe some experienced users here can give me some valid reasons why we should choose Graphical mappings. Here is what I think:
Disadvantages of Graphical mappings:
1. No way to perform automated unit testings. This is probably the biggest reason I hate it. You can do some tests manually when you work in Integration Builder. But there is no way you can write some unit testing utilities to automate the task.
2. Complexity. Even for some simple requirements, your Graphical mappings can become complicated and hard to understand. A lot of times, I find myself staring at several dozens of graphical nodes and try to understand what it does.
3. Impossible to reuse. This is totally against the DRY (Don't repeat yourself) principle. For example, to generate messages for JDBC adapter, it is common to have two identical fields for primary keys: one in the access node and another in the key node. If you change the mapping logic in one, you have to remember to change the other.
Advantage with Java mappings:
1. Fully automated unit testing. You can create JUnit tests along with your Java mapping classes and use Maven or other build tools to perform automated unit testing.
2. Your choice of XML parsing and binding. With Java mapping, you can choose any open source framework for XML parsing and binding. For example, with XMLBeans, I can convert XML input message to a Java object, transform to another Java object and write to output message. And each Java object is generated from its corresponding XML schema.
3. Highly reusable. We can use fundamental object-oriented designs to create highly reusable mapping components.
4. Better version control. Since the mappings are just Java classes, we can use CVS or SVN to track code changes.
5. Better build tools. We can fully utilize build tools like Ant and Maven to automate the build, unit tests, or even generate documents and mapping web sites.
So do you guys agree? Maybe I am still new to XI or I am missing some important things. But at this point, I just don't see why I should use Graphical mappings. Is there anyone developing XI interfaces completely with Java mappings?
Thanks in advance for any comments!
Kenny CheangHi Suraj,
> Since its graphical the blocks will take space, but
> there is always an adavntage of processing time.
> Ebven though it may appear bigger, it will take less
> time as compared with Java code (for the same
> mapping).
Could you explain more why the graphical mapping has better performance? I thought the graphical mapping is compiled into a Java class in the runtime anyway.
> Yes thats there, but same goes with Java mapping too
> right (if you haven't mentioned it as constants)
I mainly think about inheritance. If I have to build 10 interfaces and they all have some common behavior, I can create a base interface class to encapsulate the common logic. But with graphical mapping, you have to duplicate them in each interface.
> Disadvantages of Java mapping:
> 1. Performance
Same as above. I just don't see why Java has worse performance. I actually think Java should have better performance. You can optimize the code anyway you want. In some cases, you have to use queue functions in graphical mapping but it's not necessary in Java.
> 2. All might not be well versed with Java Code(though
> everyone may know basic java) .
I am not asking everyone to abandon graphical mapping. I am just wondering which one is better when you have skills for both.
> 3. Lot of standard functions are available in GM
> which you can choose, but you have to remember the
> exact code for those in Java mapping.
You can create functions in Java too. All you have to do is to remember the function name.
Kenny
Maybe you are looking for
-
Help! DV7-1020US - "No emulation System Type 00" when upgrade Vista to WIndows 7
Hi, I'm trying to upgrade an HP DV7-1020us from Vista Home Premium to Windows 7 Home Premium. When the laptop reboots as part of the installation, I get a message: 0: No emulation system type 00 1: No emulation system type 00 I've seen similar pro
-
A sentence in rich text (change in Options, Delivery format) appears as a single sentence in browser. But when I check the page source I see that sentence has been broken in to multiple lines. Why is this done? Isn't this a bug? When viewed in a brow
-
Has Anyone Experienced This Situation WIth Video Ipod (40gig)
This might seem trivial but i have noticed something happening recently on my ipod. You know how when you are listening to a song and you press the middle button twice the display on the screen will be a picture of the album or CD from which the song
-
2006 Macbook occasionally freezes upon wake up. OSX Lion
Macbook 2006 occasionally freezes upon waking up from sleep (lid-down). - screen displays desktop but keypad/trackpad don't work. I have to forcefully power down and then upon re-boot, it will work. This problem has surfaced since I installed LION...
-
Firefox 12 installer asks for Administrator account
I am trying to do a fresh install of Firefox 12 on my Windows Ultimate x64. When I try to run the installer, it asks for Administrator rights. Regardless of what I choose (use my current account, which is an administrator account OR type in the passw