Created attachment 149910 [details]
Source file with fields in right position
The attached spreadsheet form display fields correctly positioned and *all* fields (text box, radio buttons, list box) are anchored in cell and their size were set "adjust size to cell size" (or the like in English), using context menu on selected fields.
Symptom: On exporting to PDF form, the fields are shifted to wrong position, often overlapped and makes PDF form unusable.
* The effect seems random. Sometimes it works, sometimes it produces a messy PDF.
* it seems to depend on saving and reopening the file
* on adding or removing lines/columns/cells,
* perhaps on cell position recalculation in page, with effect on anchoring.
* On cell rendering, the field anchoring changes, seems to shift to a neighbor cell
* field size does not follow cell size.
* suspicion on rounding number for cell position and field position calculation.
* suspicion on memory leak or uninitialized variable.
Affects LibreOffice 6.1.5 and later, not tested with earlier versions.
Tested on Linux (6.2.1 and okular) and Windows (LO 6.1.5, with display in Acrobat Reader DC)
Created attachment 149911 [details]
Produced PDF file with fields in worng position
Some further information:
* On exporting each sheet in one PDF document (1 sheet per page), the fields are not shifted.
* After opening the form, it seems that the page rendering is introducing small offsets in cell position and often the anchor jumps to a neighbor cell.
Does setting "Use printer metrics for text formatting" (Tools -> Options -> LibreOffice Calc -> General: Input settings checkboxes) and tweaking the fielded sheet help to hold positions on export to PDF?
Working the test document, I see cells shift within Calc when setting unsetting the use printer metric value. But the PDF export is consistent with/without.
Don't know if that is full extent of the layout changes you see, but may be contributing. And of course we can't leave the printer metrics enabled all the time as it kills sheet performance.
Another hint that help to overcome the issue:
1) Open the spreadsheet form,
2) do all editions, set all fields positions.
3) *save file*
4) *close file*
5) Open file
6) export to PDF. *Do not edit file before exporting to PDF*