Files
LibreOffice-macro-for-image…/README.md
2026-06-15 21:33:13 +02:00

62 lines
2.7 KiB
Markdown

# LibreOffice Image Macro
Vkladá obrázky do buniek LibreOffice Calc.
## Použitie
1. Otvorte `znova.ods`, pri výzve povoľte makrá.
2. Na hárku **Vyber** vyplňte stĺpec **H** cestou k obrázku a stĺpec **I** odkazmi na cieľové bunky (napr. `Vysledok.B5`), voliteľný stĺpec **J** udáva výšku v pixeloch pri zachovaní pomeru strán.
3. Spustite makro: Stlačte tlačidlo.
Opätovné spustenie vymaže všetky predtým vložené obrázky a prekreslí ich.
## Pridanie tlačidla na spustenie makra
Tlačidlo môžete pridať priamo na hárok/stránku a spúšťať makro jedným kliknutím. Funguje v **Calc**, **Writer** aj **Draw**.
1. Otvorte dokument.
2. Prejdite na **Zobraziť → Panely nástrojov → Ovládacie prvky formulára**.
3. Na paneli **Ovládacie prvky formulára** zapnite **Režim návrhu**.
4. Kliknite na ikonu **Tlačidlo**.
5. Ťahaním umiestnite tlačidlo na hárok alebo stránku.
6. Kliknite pravým tlačidlom na tlačidlo a vyberte **Vlastnosti ovládacieho prvku**.
7. Na karte **Všeobecné** nastavte text tlačidla v poli **Popisok**.
8. Prejdite na kartu **Udalosti**.
9. Vedľa položky **Spustiť akciu** kliknite na tlačidlo **…**.
10. Vyberte svoje makro:
**Moje makrá** alebo váš dokument → knižnica → modul → názov makra.
11. Kliknite na **OK** a zatvorte okno vlastností.
12. Vypnite **Režim návrhu**.
13. Kliknutím na tlačidlo spustíte makro.
---
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`) 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.