Hiding Jpeg with cell
Hiding Jpeg with cell
Is there any way to hide pictures along with cell?
Summary
I have created about 50 columns of list of items for products, each of them contains picture of the product,
When the product is not in used for that project, I will hide the column, however, the picture does not hide with it, even after I have anchored it to the cell.
Anyway, to hide the jpeg along with the cell?
Thanks
Summary
I have created about 50 columns of list of items for products, each of them contains picture of the product,
When the product is not in used for that project, I will hide the column, however, the picture does not hide with it, even after I have anchored it to the cell.
Anyway, to hide the jpeg along with the cell?
Thanks
Re: Hiding Jpeg with cell
You can achieve this task with some macro programming:
Set the Macro security to "medium" before you open my sample file.
Set the Macro security to "medium" before you open my sample file.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Hiding Jpeg with cell
Thank you, after following the instructions above and setting the macro security to "Medium"
I reopen the file, it says
Quote:
"BASIC runtime error.
Object variable not set."
The picture doesn't hide either when i hide the cells,
I reopen the file, it says
Quote:
"BASIC runtime error.
Object variable not set."
The picture doesn't hide either when i hide the cells,
Re: Hiding Jpeg with cell
I created ant tested the macro in my LibreOffice 5.4.6 version. It works well, without any error message.
And it works in my AOO 4.1.5 portable version AFTER acknowledgment of the error messages (four times).
Note: my macro is a sample only - how to hide/show a picture by a macro. The hide/show "Event" is the changing of the cell content in the column "A", but not the Hiding a column.
And it works in my AOO 4.1.5 portable version AFTER acknowledgment of the error messages (four times).
Note: my macro is a sample only - how to hide/show a picture by a macro. The hide/show "Event" is the changing of the cell content in the column "A", but not the Hiding a column.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Hiding Jpeg with cell
Ok, I got it..
I manage to hide the pictures by toggling the number 1 and 0
However, is it possible to fix the jpeg into a cell block and hide the fixed picture with the cell when you "hide column/row?
I manage to hide the pictures by toggling the number 1 and 0
However, is it possible to fix the jpeg into a cell block and hide the fixed picture with the cell when you "hide column/row?
Re: Hiding Jpeg with cell
Use this macro to determine if a specific column is visible or not:
Usage:
=Function IsVisible_col("D")
the result will be 0/1 (false/true). Use the result as input parameter of the another function.
Code: Select all
Function IsVisible_col(ColName as string) as boolean
Dim oDoc as object
Dim oSheet as object
Dim oColumns as object
Dim oCol as object
oDoc = ThisComponent
oSheet=oDoc.getcurrentcontroller.activesheet
oColumns = oSheet.getColumns()
oCol = oColumns.getByName(ColName)
IsVisible_col = oCol.isVisible
end function
=Function IsVisible_col("D")
the result will be 0/1 (false/true). Use the result as input parameter of the another function.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Hiding Jpeg with cell
I won't talk about OpnOfficeorg V 3.1 (as the OQ put in his signature). The behaviour of recent versions of AOO (as now the brand is) will be different, and there will be very few contributors to this forum still knowing anything about 3.1 for sure regarding such specific concerns.
I can tell that the current version 4.1.5 of AOO behaves inconsistent (imo) with this respect.
However, starting with version 4.1 (datestamped 2013-07-05 at latest) LibreOffice introduced a behaviour probably satisfying the OQ:
Hiding a column or a row the images anchored to a cell of that column/row get hidden if they were by width/height completely inside the hidden column/row.
I can tell that the current version 4.1.5 of AOO behaves inconsistent (imo) with this respect.
However, starting with version 4.1 (datestamped 2013-07-05 at latest) LibreOffice introduced a behaviour probably satisfying the OQ:
Hiding a column or a row the images anchored to a cell of that column/row get hidden if they were by width/height completely inside the hidden column/row.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: Hiding Jpeg with cell
I tried a bit more. Inserted images are among the shapes contained in the DrawPage of a sheet. To hide the shapes that are anchored to to hidden cells (column or row hidden) the ollowing code should work:
In LibreOffice (tested with 6.0.,3) images are handled inconsistently in a way I cannot even describe clearly if columns/rows get hidden where the images were anchored but not completely contained. The shown size is afflicted. Anyhow the changes seem to be reversible. The above code, however, works as expected.
We would surely prefer to get the action tríggered by hiding/showing columns/rows. I do not know a way to organise that. Dont know an appropriate listener type.
In AOO 4.1.5 hiding a column/row containing cells to which shapes are anchored moves the anchor. The test appied by the Sub can therefor not work. In addition the anchor is (of course) not moved back if the column/row is shown again. It's a bug.
Code: Select all
Sub adjustShapeVisibilityToAnchorCellVisibility(Optional pSheet As Object)
doc0 = ThisComponent
If NOT doc0.SupportsService("com.sun.star.sheet.SpreadsheetDocument") Then Exit Sub
If IsMissing(pSheet) Then
pSheet = doc0.CurrentController.ActiveSheet
Else
If NOT pSheet.SupportsService("com.sun.star.sheet.Spreadsheet") Then Exit Sub
End If
theDP = pSheet.DrawPage
For k = 0 To theDP.Count - 1
theShape = theDP(k)
If theShape.Anchor.SupportsService("com.sun.star.sheet.SheetCell") Then
theCell = theShape.Anchor
If NOT theCell.Columns(0).IsVisible OR NOT theCell.Rows(0).IsVisible Then
theShape.Visible = False
Else
theShape.Visible = True
End If
End If
Next k
End Sub
We would surely prefer to get the action tríggered by hiding/showing columns/rows. I do not know a way to organise that. Dont know an appropriate listener type.
In AOO 4.1.5 hiding a column/row containing cells to which shapes are anchored moves the anchor. The test appied by the Sub can therefor not work. In addition the anchor is (of course) not moved back if the column/row is shown again. It's a bug.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: Hiding Jpeg with cell
Sorry for the confusion, I am totally new here, and didn't know about the latest Version of Open office, but, yes I am using the latest AOO.Lupp wrote:I won't talk about OpnOfficeorg V 3.1 (as the OQ put in his signature). The behaviour of recent versions of AOO (as now the brand is) will be different, and there will be very few contributors to this forum still knowing anything about 3.1 for sure regarding such specific concerns.
I can tell that the current version 4.1.5 of AOO behaves inconsistent (imo) with this respect.
However, starting with version 4.1 (datestamped 2013-07-05 at latest) LibreOffice introduced a behaviour probably satisfying the OQ:
Hiding a column or a row the images anchored to a cell of that column/row get hidden if they were by width/height completely inside the hidden column/row.
Re: Hiding Jpeg with cell
Please update your signature in this forum. (User Control Panel: Profile TAB - Edit signature sub-TAB.)yes I am using the latest AOO.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Hiding Jpeg with cell
See [Tutorial] Some useful hints on using images for a discussion on how best to handle images in Writer. Much applies to Calc.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Hiding Jpeg with cell
A database could do what you want.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice