Macros in Java
Hi
I have an urgent requirement of writing Macros in Java for the Open Office that we are using. Any site with information about it would be very helpful.
Thanks in advance
We can assign custom scripts (macros) to menu items, icons, dialog controls, and events in OpenOffice.org.
OpenOffice.org internally supports the following scripting languages:
1.OpenOffice.org Basic
2.JavaScript
3.BeanShell
In addition, developers can use high-level languages, for example Java programming language, to control OpenOffice.org externally. See the API project at OpenOffice.org.
Similar Messages
-
I have already created an mdb file and a report that prints / previews the data of a specific table. I am wondering if there is a way to open that report using java. I am thinking that maybe i could do that by forming a macro in ms access that calls for that report and then use java to call that specific macro. Is it possible? Please help me, it is urgent to say the least! Thank you in advance!
babisteowhat about using jdbc instead.
you could define your own "reports" and show them e.g. using a java gui.
seems to me to be easier ... -
Read Excel with macros using Java POI
Hi,
I'm very desperate... I have to do following things: read Excel file with macros. I can read xls without macros, but i haven't ideas what to do, so correctly read records with macros in xls.
I use following method to listen for incoming records and handles them as required.
public void processRecord(Record record)
switch (record.getSid())
// the BOFRecord can represent either the beginning of a sheet or the workbook
case BOFRecord.sid:
BOFRecord bof = (BOFRecord) record;
if (bof.getType() == bof.TYPE_WORKBOOK)
System.out.println("Encountered workbook");
// assigned to the class level member
} else if (bof.getType() == bof.TYPE_WORKSHEET)
System.out.println("Encountered sheet reference");
break;
case BoundSheetRecord.sid:
BoundSheetRecord bsr = (BoundSheetRecord) record;
System.out.println("New sheet named: " + bsr.getSheetname());
break;
case RowRecord.sid:
RowRecord rowrec = (RowRecord) record;
System.out.println("Row found, first column at "
+ rowrec.getFirstCol() + " last column at " + rowrec.getLastCol());
break;
case NumberRecord.sid:
NumberRecord numrec = (NumberRecord) record;
System.out.println("Cell found with value " + numrec.getValue()
+ " at row " + numrec.getRow() + " and column " + numrec.getColumn());
break;
// SSTRecords store a array of unique strings used in Excel.
case SSTRecord.sid:
sstrec = (SSTRecord) record;
for (int k = 0; k < sstrec.getNumUniqueStrings(); k++)
System.out.println("String table value " + k + " = " + sstrec.getString(k));
break;
case LabelSSTRecord.sid:
LabelSSTRecord lrec = (LabelSSTRecord) record;
System.out.println("String cell found with value "
+ sstrec.getString(lrec.getSSTIndex()));
break;
case FormulaRecord.sid:
FormulaRecord fre = (FormulaRecord) record;
System.out.println("Formula: "+ fre.getValue());
break;
I don't know, how check, that incoming record is joined with macro and I don't know how handle it.
Is there possible to create Excel file with macros using POI?
Please help me...
MargaretI want to read the contents of an MS Excel file from
java, is it possible using JavaBeans-ActiveX bridge or
by any other java technologies, if possible, how ?Bridge2Java from IBM Alphaworks will do the trick for you.
You can get it from here:
http://www.alphaworks.ibm.com/aw.nsf/techs/bridge2java
Using it, you can do things like the following (taken and abbreviated from the samples provided with the package):
import Excel.*;
public class QuickExcel
public static void main(java.lang.String[] args) {
Application app;
Workbooks wbs;
Workbook wb;
Worksheet sheet;
Range rangeA1, rangeA2;
try
com.ibm.bridge2java.OleEnvironment.Initialize();
app = new Application(); // Excel.Application !!! :-)
app.set_Visible(true);
wbs = app.get_Workbooks();
wb = wbs.Add();
sheet = new Worksheet(wb.get_ActiveSheet());
rangeA1 = sheet.get_Range("A1");
String out = new String("This is a test");
rangeA1.set_Value(out);
// Wait five seconds
Thread.sleep(5000);
// Close the workbook without saving
wb.Close(new Boolean("false"));
app.Quit();
} catch (com.ibm.bridge2java.ComException e)
System.out.println( "COM Exception:" );
System.out.println( Long.toHexString((e.getHResult())) );
System.out.println( e.getMessage() );
} catch (Exception e)
System.out.println("message: " + e.getMessage());
} finally
app = null;
com.ibm.bridge2java.OleEnvironment.UnInitialize();
} -
Executing Microsoft access macros using java
Hi Everyone,
I hava an application in microsoft access,in which many macros which extract data are there.I want to know is there anyway that I can execute the macro written in microsoft access using java.
Can anyone please answer the above.
Regards,
Rakesh.rakbha wrote:
I hava an application in microsoft access,in which many macros which extract data are there.I want to know is there anyway that I can execute the macro written in microsoft access using java.
I am rather certain that that is not possible via the ODBC driver and thus not possible via JDBC.
There is certainly an OS API that will allow that but accessing those is not a standard part of the Java API so it would require a JNI solution (yours or someone else's) or an application that allows that access. -
Call Excel Macros function from Java
Hi All,
can u guide me How to call excel macros from java.
The thing is first I have to enable macros and then call the macors function.
Is this possible to call from Java. If yes guide me.
Thanks in AdvanceSeems like something you'd have to do through COM.
http://sourceforge.net/projects/jacob-project/
HOW you do that is something you'll really have to figure out yourself, its not a Java question. -
Exporting macro along with data - BEx web
Hi,
I have to send BEx web data along with a macro. The purpose is every report user down loads in his desktop gets an unique macro along with the data. The user can later use that macro for further analysis of the downloaded data.
I was reading through the How to Use Web Printing with Microsoft Excel document which details about various objects such as Packages and ABAP classes. The ABAP class ZCL_RSR_XLS_ITEM_TEMPLATE contains methods such as SET_ITEM,RENDER_DATA,LOAD_TEMPLATE_FROM_DB,GET_TEMPLATE...etc. My question is whether these class and mehtods can it be enhanced to include a macro ???
Any suggestions is eagerly awaited,
Regs
D BretHi Arun,
How do you access / write excel macros using jave scripts ? can please send me an example ? In the mean time let me explain you my requirement again...
My end users are not happy with Web printing so they have decided to go with exporting web report an excel sheet. But once the data been collected in excel sheet many of the users wld like to have some mechanism to strip that exported excel data into multiple sheets. so that is the reason its been decided to send the generic macro to end users who exports the BEx report to an excel sheet and process it....
thanking you in advance,
D Bret -
Java Script???? Maybe???
I have a really repetive thing that is sucking up lots of my time on my deadline. I guess I can write some sort of macro(/) using java script ot get this to repeat somehow...NO time to read the entire javascript manual I found online for verison 6 . I have Acrobat X.
I have a row of dollar amounts
$$$$ $$$$$ $$$$ $$$$ $$$$ $$$$$ $$$$$ date $$$$$total of all previous monies
Anyone know how to write the java script for this????
Thank you.Yes. but it can be made easier if you use a hierarchical naming convention placing one field at row one and and naming it "Row". Now highlight the field and select "Place multiple fields" and create enough fields for the number of rows. Select the row 1 field and repeat the place multiple fields across the row. You now only have to select the field name "Row.0" for the first row.
With a custom JavaScript you would still need to specify each field name.
event.value = Number(this.getField("Field1").value) + Number(this.getField("Field2").value) + Number( this.getField("Field3").value) + Number(this.getField("Fieldn").value); -
Can I run a Visual Basic macro from Java? How do I do that?
If your macro can be invoked from the command line, then you should be able to run it by using Runtime.exec()
-
How to get an array variable to update in a loop
Hi
I have an array of doubles called cps that contains a double h.
the array is defined out of the loop.
The loop defines the value of h and uses that array to do something. How can I get the array to update h at every iteration of the loop?
// STAR-CCM+ macro: test.java
package macro;
import java.util.*;
import star.common.*;
import star.base.neo.*;
import star.vis.*;
import star.base.report.*;
public class test extends StarMacro {
public void execute() {
double h ;
int i;
double[] cps= new double[] {75.9042408986955, 52.51153872409542, h, 76.51180919240942, 49.49901260109725, h, 77.70163043426585, 49.67622002009714, h, 78.35982941912259, 46.537117169241895, h, 78.08136061783705, 45.42324196409971, h, 75.67640278855279, 44.840989015957206, h, 68.73999810198555, 40.942425797959565, h, 66.66413976512966, 44.511889523528836, h, 67.85396100698608, 44.99288108938568, h, 68.81594413869979, 45.65108007424243, h, 69.37288174127089, 46.081440948956455, h, 68.99315155769969, 46.992793389527336, h, 68.38558326398577, 48.005407212383865, h, 67.8792763525575, 48.81549827066909, h, 73.423337032697, 51.954601121524334, h};//coordinates of constrained section plane
Simulation simulation_0 =
getActiveSimulation();
// CREATING CONSTRAINED PLANE SECTIONS //
Region region_0 =
simulation_0.getRegionManager().getRegion("main domain;main domain;NONE");
Units units_0 =
((Units) simulation_0.getUnitsManager().getObject("m"));
i = 0;
for ( h = 0.5; h <= 2; h = h + 0.5) {
i = i + 1;
ConstrainedPlaneSection constrainedPlaneSection_i =
(ConstrainedPlaneSection) simulation_0.getPartManager().createConstrainedPlaneImplicitPart(new NeoObjectVector(new Object[] {region_0}), new DoubleVector( cps ), units_0); // Sets Plane Boundaries (as mapped) //
LabCoordinateSystem labCoordinateSystem_0 =
((LabCoordinateSystem) simulation_0.getCoordinateSystemManager().getObject("Laboratory")); // Defines Lab Coordinate System (Does this once). //
constrainedPlaneSection_i.setCoordinateSystem(labCoordinateSystem_0); // Sets this planes coordinate system //
Coordinate coordinate_i =
constrainedPlaneSection_i.getOriginCoordinate();
coordinate_i.setCoordinate(units_0, units_0, units_0, new DoubleVector(new double[] {71.92329015, 46.4835809, 0.5})); // Sets the origin for the plane //
constrainedPlaneSection_i.setPresentationName("Unit 1 " + h + "m");
}double h ;
double[] cps= new double[] {75.9, 52.5, h, 76.5, 49.4, h, // simplifiedLooking at your code I see that you have initialised your array with the value of the variable h scattered throughout it. Are you asking how you can update these "h" values in the array each time around the loop? eg:
Initial array: 75.9, 52.5, 0.0, 76.5, 49.4, 0.0
1st iteration: 75.9, 52.5, 999.999, 76.5, 49.4, 0.0
2nd iteration: 75.9, 52.5, 999.999, 76.5, 49.4, 999.999
Something like that.
If so then you need to know what the indicies of the numbers you want to update which may not be a simple matter. Perhaps an array is not what you want here but maybe a Map instead. -
Hi...
I have a msaccess db with pair of tables from db2 and pdb files, using pdb odbc driver. What i want to do is, from a java app to copy the entire contents of the db2 table to its respective pdb file. I tryed tow things
1. Create a msaccess macro that exports the db2 table within msaccess to the pdb file using the pdb driver... but i dont find anything about calling macros from java.
2. Execute a SQL (Insert into pdbtable Select db2table), but when the table is empy (wich usually is) the command doesnt create any row.
So... is there any idea how to do any of the thing above, or is there any better way to achive this?
Thanks a lot.If you're sing MS Access's mdb, not pdb, database, you can try HXTT Access(www.hxtt.net), a commerical JDBC package for MS Access. You should read Bulk Insert A ResultSet from any JDBC driver at http://www.hxtt.net/access/advanced.html#insertresultset .
Yonghong Zhao
System Analyst
www.hxtt.net -
I'm a fairly new Java programmer, coming from a C++ background. Over the past several months, I've written about 26000 lines of Java code, with heavy use of the assert statement to catch bugs and invalid data. Works great. I'm using Borland JBuilder 9, Weblogic edition.
Now that I'm trying to deploy, I've found that assert is broken. You see, in C++ land, assert is useful because it is ignored unless you are in debug mode. Ignored means the compiler ignores it, and the arguments in it aren't evaluated. Won't affect performance.
But now, when I adjust the project settings and uncheck the box that says "enable the assert keyword", I suddenly find my code full of errors: assert isn't ignored, it's just uncompilable!
Hopefully I'm missing something important here. Or is this just broken? Is there a way I can make it ignore (and not evaluate!) the contents of the assert statements? I guess in C++ it's easier, becase assert is a macro. Hmm, maybe this is the reason why it is the way it is: no macros in Java. Am I right?
--- Ericassert's not broken, it's a flaw either in JBuilder or your understanding.
Why is it that when people have problems they automatically assume that they're doing everything right and the JVM is bugged? I don't get it.
I think you're the problem. Dig deeper - there's a flag in the JVM that will tell the compiler/runtime to ignore the asserts. I just don't know what it is, because I don't use assert. I find that it's always turned off at runtime. During development, I'd rather have a full set of JUnit tests than all the asserts in the world. JMO -
Can Java executes Microsoft Access Macro?
Is there any way to run a Macro of Access database from Java? How to
do it if so?
I searched the internet, I have not found an answer yet. It seems
there is no way. true or false?
We have a lot of statistic charts generated by Macros of either Access
database or Excel and want to put on the web so that user can view the
charts by a click from anywhere. Our web applications are developed
in JSP and on Tomcat.
Any suggestions are appreciated.
Thanks**MAJOR SPAMMING SCUM BAG ALERT**
I was puzzled in that you asked a SQL Server question in one post and then in another thread asked a Oracle related question... and then I noticed you had cross posted one of your questions at JavaRanch and I was more annoyed....
and then I found this....
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=10&t=002447
You sir -> Michael Byrd -> are scum sucking dirtbag.
To quickly explain. Mr. Byrd posts his messages (which he copies wholesale from other posters) so that he can get better google caching for the website listed in his profile.
This is such scummy behaviour I don't even know what to say. Other than basically everyone that has ever helped you had totally wasted their time.
You are scum. Your company is scum. I hope you rot in hell. -
Calling WebAS Java from Excel Macro
Hi,
somebody told me there were a way to call WebAS Java from an Excel Macro and make a login into SAP using a real existing user (not a technical user). Does anybody know where to find documentation about this or how to get this accomplished?
Thanks, Oliver PlohmannHi,
Have a look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnofftalk/html/office09062001.asp
Eddy -
Windows Macro Engine for use with Java Apps
Does anyone know of a macro engine that can be used under windows for interaction with a Java app? None of the ones I've tried will work with Java Apps. Work great with everything else I've tried, just not Java apps.
WillWhat exactly is a macro engine? What do you want it to do? Do you want to add scripting to your application? Or do you want to script third party applications, that don't support it themselves?
-
Java - Automatic logon with macros
Hi All,
I have an application where user login details has to be saved outside database like macro.
What the better way of storing and retreiving login details through macro.which libraries we use
for theis purpose.Could some one throw some light on this please.
Thanks
KanthThen my suggestion about a long-living cookie with an unique ID still applies.
For each client you need to create a long-living cookie (1 year or so and update it on every visit) with a long and all-time-unique/garbled/random/hard-to-guess ID, if it is not already generated before (just traverse the retrieved cookies). Store this ID in a database table in the server side. In the same database you can just attach all logged in users of the same client to the same ID. Whenever the specific client visits the login page again, you just lookup all associated users from the DB table and displays it so that the client can choose from them.
Do in no way store sensitive information (usernames/password/userids/etc) at the client side. This is too hack sensitive.
Maybe you are looking for
-
in adobe PSE and in Nion NX2, I open 2 group Photos, select a head in photo 1 and copy, go to photo 2 and paste. Than only the selection-line appears and no head is visible! Who can tell me what is going wrong? Thanks: Max.
-
Final Cut after system restore
Hi all. I wonder if you can answer a question for me? I have recently been having issues with my MacBook and believe the only way to resolve them would be via restoring my MacBook to factory settings. My question simply is this. As Final Cut Express
-
SQL 2000 SMTP works from outlook, fails from SQL
We have an older SQL2000 server running on Windows 2003 that we can't get rid of yet or upgrade to a newer version of SQL due to legacy software. It will hopefully be gone in the next 12 months or so but it needs to keep running for now. It has bee
-
Hi I can not see the role menu in WAD BI 7.0 nor BI 7.1? Does it mean we can not set the role menu anymore?
-
Help i trying to divide number in adobe reader canat do this plase help i upload a photo
i need to make script that wain i put the rent amount and the balance the program divide the balance with the rent like you see in the pic so the total balance is $1150.00 and the rent is $250.00 so its 4 month and $75.00 for 3 $25.00 late fees and