[Solved] Add Image using macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
jenny143
Posts: 82
Joined: Wed Oct 19, 2011 1:40 am

[Solved] Add Image using macro

Post by jenny143 »

Goodday
im using andrewbase
http://www.pitonyak.org/database/AndrewBase.pdf
Page 155 in file, 148 in document
A.3. Add an image macro



im having a error whenever i using the macro...

nImage = oImagesForm.findColumn("IMAGE")

anyone have a tried and finish this program???
or theres any sample program for this??
so that i can compare my work for this??
Attachments
imagesextraction.odb
(16.48 KiB) Downloaded 307 times
Last edited by Hagar Delest on Tue Nov 15, 2011 1:29 pm, edited 1 time in total.
Reason: tagged [Solved].
Windows XP and Open Office 3.3
pitonyak
Volunteer
Posts: 186
Joined: Sun Oct 07, 2007 9:13 pm
Location: Columbus, Ohio, USA

Re: Add Image using macro

Post by pitonyak »

Couple of comments.

I usually Associate your buttons to "Execute Action" rather than the mouse click so that it does not matter how the button is pressed.

Your buttons assumed that the macros were in Standard, and they were not.

Add Image does not work because the form is different than your macro dictates. I cannot trace it now because I have a three year old jumping on me.... Sorry.
Andrew Pitonyak
http://www.pitonyak.org/oo.php
LO and AOO on Fedora
pitonyak
Volunteer
Posts: 186
Joined: Sun Oct 07, 2007 9:13 pm
Location: Columbus, Ohio, USA

Re: Add Image using macro

Post by pitonyak »

Adding an image fails because field names are not correct, and neither is the frame name containing the data.

When I try to add, this fails because of a parent constraint, which means that the there are bigger problems than just dealing with the image.

Now perhaps if I prepopulate the Dealer and Category table, that will help. I will create a few dummy entries.

You call methods that are not in the file (such as GraphicFilters())

This is about where I gave up....
Andrew Pitonyak
http://www.pitonyak.org/oo.php
LO and AOO on Fedora
User avatar
jenny143
Posts: 82
Joined: Wed Oct 19, 2011 1:40 am

Re: Add Image using macro

Post by jenny143 »

Update me, if the bug in adding image is not error?
:D
Windows XP and Open Office 3.3
pitonyak
Volunteer
Posts: 186
Joined: Sun Oct 07, 2007 9:13 pm
Location: Columbus, Ohio, USA

Re: Add Image using macro

Post by pitonyak »

What I am saying is that when I took the time to look through the code and such, I never made it to the point where I could simply worry about adding an image to a table.... I am very busy and very behind on the list of things I must do so I only spent 30 to 60 minutes poking around the code, fixing one thing after another. Sadly, this is an area I do not spend much time and there were some changes since I last looked at it (because it broke my existing databases so that they no longer function). That annoyed me enough that I considered rewriting everything in C++ and QT, completely ignoring OOo. Lack of time, however, convinced me to simply walk away from it and not update my database at all. I may simply purchase a professional product dedicated to my problem set.

If I have some free time, I will take another look.
Andrew Pitonyak
http://www.pitonyak.org/oo.php
LO and AOO on Fedora
RPG
Volunteer
Posts: 2261
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Add Image using macro

Post by RPG »

Hello Andrew Pitonyak

I think there is not much wrong with the code in your pdf book. The OP did forget the book is also for study and not only for copy the macro. It seems to me macro programming is to difficult for OP there there is lack of understanding of the API. In this lack of understanding of the structure of the forms the OP thinks all errors are bugs in your code but I think the OP must change the code to the changes made in the form made by you or by the OP.

Romke
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
User avatar
Villeroy
Volunteer
Posts: 31363
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Add Image using macro

Post by Villeroy »

SInce OOo 3.2 it is very easy to link pictures files relatively to the database path. Just drop (or concatenate) the file names and bind a picture control to the VARCHAR field.
With the help of a text table you can bind a single column file listing generated from a shell script.

picture_links.zip [picture files, list of picture files and an embedded HSQLDB in one directory]
list > text table > list box > picture control
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
jenny143
Posts: 82
Joined: Wed Oct 19, 2011 1:40 am

Re: Add Image using macro

Post by jenny143 »

i already debug the program of pintoyak...
and it works... fine... without errors :D and i set button for another big image
thanks

maybe i will work hard for the sample of image in a folder of villeroy
"because the advantage of it, it will not occupy more space to the database"

nice tread jenny :)
Windows XP and Open Office 3.3
quirkygal
Posts: 1
Joined: Fri Oct 25, 2013 3:51 am

Re: [Solved] Add Image using macro

Post by quirkygal »

I just wanted to say, "THANK YOU!" to Villeroy for posting the sample file.

I'm a database newbie and I've been going bonkers trying to figure out how to add images to a form. Thanks to your sample file I was able to see what I was doing wrong (almost everything) and get my database up and running.

I'm a very happy camper :bravo:
---------
Open Office 4 on Windows 7 Premium 4 bit
Post Reply