how to add button

This commit is contained in:
Priec
2026-06-15 21:30:20 +02:00
parent 9cc3e3cfce
commit 0c2a7aed19

View File

@@ -5,7 +5,26 @@ Inserts images into LibreOffice Calc cells based on a mapping table.
## Usage
1. Open `znova.ods`, enable macros when prompted.
2. On the **Vyber** sheet, fill column **H** with image file paths and column **I** with destination cell references (e.g. `Vysledok.B5`).
3. Run the macro: **Tools -> Macros -> Run Macro...** -> expand `znova.ods` -> `Standard` -> `image_macro` -> `ShowImages` -> **Run**.
2. On the **Vyber** sheet, fill column **H** with image file paths and column **I** with destination cell references (e.g. `Vysledok.B5`) and optional column **J** is for heigh in pixels while keeping the aspect ration.
3. Run the macro: Press the button.
Running again clears all previously inserted images and re-draws them.
## Adding a Button to Run the Macro
You can add a push button directly to your sheet/page that runs the macro with a single click. This works in **Calc**, **Writer**, and **Draw**.
1. Open your document.
2. Go to **View → Toolbars → Form Controls**.
3. Turn on **Design Mode** on the Form Controls toolbar.
4. Click the **Push Button** icon.
5. Drag on the sheet/page to place the button.
6. Right-click the button → **Control Properties**.
7. In the **General** tab, set the button text in the **Label** field.
8. Go to the **Events** tab.
9. Next to **Execute action**, click the **…** button.
10. Select your macro:
- **My Macros** or your document → library → module → macro name.
11. Click **OK**, then close the properties window.
12. Turn **Design Mode** off.
13. Click the button to run the macro.