Bug 167203 - '‘Paste special’' of the Macro doesn't work when the pushbutton is used first.
Summary: '‘Paste special’' of the Macro doesn't work when the pushbutton is used first.
Status: RESOLVED DUPLICATE of bug 70883
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Paste Macro
  Show dependency treegraph
 
Reported: 2025-06-25 12:42 UTC by Christophe FERE
Modified: 2025-12-31 08:18 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
PushButton + Macro = No Paste special ! (33.09 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-06-25 12:42 UTC, Christophe FERE
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe FERE 2025-06-25 12:42:22 UTC
Created attachment 201466 [details]
PushButton + Macro = No Paste special !

PushButton and Macro.

The macro detects the last line of the table, copies the contents, then adds a line at the end of the table and performs a “Paste Special” of the format and formulas.

1st case: Immediately after opening the file, if the macro is run from the ‘run macro’ menu or from the ‘Ctrl A’ keyboard shortcut, the line is added and the formula is present in the balance column. Everything is fine.

2nd case: However, if this macro is run using the Push Button immediately after opening the file, the line will be added and the format will be pasted, but not the formula!

3rd case: After opening the file, if I run the macro once with the ‘run macro’ command or the keyboard shortcut, I can use the button and the formula will be pasted.

There is a conflict between the button and the macro. The macro must first be run once to use the button without the ‘Paste Special’ function bug.

See file : Account_macro.ods
Comment 1 Saburo 2025-06-30 03:40:22 UTC
I think the copy failed.
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
Comment 2 Christophe FERE 2025-07-06 20:15:47 UTC
(In reply to Saburo from comment #1)
> I think the copy failed.
> dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

Copying only fails when the pushbutton is used first, otherwise copying works perfectly.
There is a conflict between the pushbutton and the formula copy.
The pushbutton cannot be used with all macros.
Comment 3 Buovjaga 2025-12-30 19:09:40 UTC
The first version where the push button did anything is 5.0 and there the problem was already seen. Tested with Windows bibisect repo.

Arch Linux 64-bit
Version: 26.8.0.0.alpha0+ (X86_64)
Build ID: 640a35801612123fa503fa72e8732cfb7e75caca
CPU threads: 8; OS: Linux 6.18; UI render: default; VCL: gtk3
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Built on 23 December 2025
Comment 4 Saburo 2025-12-31 05:38:51 UTC
repro
Version 4.0.5.2 (Build ID: 5464147a081647a250913f19c0715bca595af2f)

not repro
Version 4.0.0.1 (Build ID: 527dba6f6e0cfbbc71bd6e7b88a52699bb48799)

bibisected with linux-41max
commit 7fd1cc18130464a9f09cb7a866e88c4d52e4716d
author	Lionel Elie Mamane
fdo#63695 revert hackish fix to i#51621

***
Macro fix by gemini

- document = ThisComponent.CurrentController.Frame
+ ThisComponent.CurrentController.Frame.ContainerWindow.setFocus
+ document = ThisComponent.CurrentController.Frame
Comment 5 Buovjaga 2025-12-31 08:18:57 UTC
(In reply to Saburo from comment #4)
> repro
> Version 4.0.5.2 (Build ID: 5464147a081647a250913f19c0715bca595af2f)
> 
> not repro
> Version 4.0.0.1 (Build ID: 527dba6f6e0cfbbc71bd6e7b88a52699bb48799)
> 
> bibisected with linux-41max
> commit 7fd1cc18130464a9f09cb7a866e88c4d52e4716d
> author	Lionel Elie Mamane
> fdo#63695 revert hackish fix to i#51621

Ah, good catch. That commit is when the button stopped working completely. I think we can close as dupe of bug 70883

The current state appeared in 5.0 with 285b5ef45817fe20d3bf9613e0247d395b7c880d
Calc: Insert row/col before/after [2/2]

*** This bug has been marked as a duplicate of bug 70883 ***