Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenMon, 01 Jun 2020 03:13:10 +0200Add date calculation to Libre Drawhttps://ask.libreoffice.org/en/question/247448/add-date-calculation-to-libre-draw/ I operate a business that requires product labeling with an expiry date. I use Libre Draw for the label generation. I want to put an auto-generated expiry on each label with a date of Today + 365 days. How do I add that to Libre Draw. I assume I will use some formula in Libre Calc and move it over to Draw. I need the formula and the steps necessary to move it, or do everything in Draw if possible.
Sun, 31 May 2020 15:53:36 +0200https://ask.libreoffice.org/en/question/247448/add-date-calculation-to-libre-draw/Answer by keme for <p>I operate a business that requires product labeling with an expiry date. I use Libre Draw for the label generation. I want to put an auto-generated expiry on each label with a date of Today + 365 days. How do I add that to Libre Draw. I assume I will use some formula in Libre Calc and move it over to Draw. I need the formula and the steps necessary to move it, or do everything in Draw if possible.</p>
https://ask.libreoffice.org/en/question/247448/add-date-calculation-to-libre-draw/?answer=247512#post-id-247512- In Calc, enter formula `=TODAY() + 365` in a cell
- Select the cell and copy it
- Paste into Draw
The pasted object is a complete spreadsheet object with calculation capability. It should update whenever you reopen the file. If you leave it open, double click the date to enter Edit mode, and press function key `F9` to update.Mon, 01 Jun 2020 03:13:10 +0200https://ask.libreoffice.org/en/question/247448/add-date-calculation-to-libre-draw/?answer=247512#post-id-247512Answer by Lupp for <p>I operate a business that requires product labeling with an expiry date. I use Libre Draw for the label generation. I want to put an auto-generated expiry on each label with a date of Today + 365 days. How do I add that to Libre Draw. I assume I will use some formula in Libre Calc and move it over to Draw. I need the formula and the steps necessary to move it, or do everything in Draw if possible.</p>
https://ask.libreoffice.org/en/question/247448/add-date-calculation-to-libre-draw/?answer=247463#post-id-247463All the objects you can insert into a drawing are shapes of one or another kind, and none of them offers a service (via interface) for calculations or formatting of numeric data.
The so-called textfields you ca insert are next to useless. In specific concerning dates they aren't usable since they neither allow to define an offset (your 356 days) nor accept any reasonable format. Draw files generally don't support the NumberFormats feature.
Therefore I can only see one way:
Rely on user code (a little Basic Sub e.g.) and use the capabilities of Basic concerning calculations and formatting of numbers. The result can then be inserted into a shape as text.
Th attached example drawing is containing such a Sub whichwilol run for you as a demo. It is very primitive an will require refinements and adaptions to your needs.
[C:\fakepath\ask247448shapesShowingCalculatedDate_1.odg](/upfiles/15909424041567203.odg)
Sun, 31 May 2020 18:26:47 +0200https://ask.libreoffice.org/en/question/247448/add-date-calculation-to-libre-draw/?answer=247463#post-id-247463