How to open multiple external files within plugin executed in current spreadsheet context

Integration questions/issues
Post Reply
antiai
Posts: 4
Joined: Mon Aug 10, 2020 8:05 pm

How to open multiple external files within plugin executed in current spreadsheet context

Post by antiai » Mon Aug 10, 2020 8:38 pm

Hello.

We have a VBA script that combines different data from 2 external spreadsheet files into an existing one. So now we need to adapt such VBA script to OnlyOffice, but we're experiencing issues with opening external files in macros or plugin context.
Here is an example of plugin code:

Code: Select all

{
	window.Asc.plugin.init = function()
	{
		document.getElementById("buttonOK").onclick = function()
		{
			this.executeCommand(function() {
				builder.OpenFile("test.xlsx")
			}, true);
		};
	};

	window.Asc.plugin.button = function(id)
	{
		if (-1 === id)
		{
			this.executeCommand("close", "");
		}
	};

})(window, undefined);

Unfortunately, it does nothing and we can't understand what exactly happens - there are no warnings or errors - just silence.
Therefore we have a few questions:
1. Is there any example of a plugin that operates with multiple spreadsheet files at once? We saw this example https://github.com/ONLYOFFICE/sdkjs-plu ... other_file and tried it locally. It seems broken since it doesn't open anything external.
2. Is there any approach to debug macros or plugin (console log, some CLI commands, etc.)?

Thanks in advance!
Best regards,
Anthony

Alexandre
Posts: 151
Joined: Thu Dec 12, 2019 11:08 am

Re: How to open multiple external files within plugin executed in current spreadsheet context

Post by Alexandre » Thu Aug 13, 2020 3:37 pm

Hello Anthony.
As for your questions:
1. You mentioned that you tried this example https://github.com/ONLYOFFICE/sdkjs-plu ... other_file.
What exactly did you encounter while using it. Please give us a detailed description of your scenario.
2. Unfortunately, there’s no any debug approach.

antiai
Posts: 4
Joined: Mon Aug 10, 2020 8:05 pm

Re: How to open multiple external files within plugin executed in current spreadsheet context

Post by antiai » Fri Aug 14, 2020 12:14 pm

I downloaded example files, compressed them to zip file, and changed the file extension to .plugin without any code change. After that, I added the newly created plugin to a SpreadSheet. And that's how it works: https://take.ms/CdSnk
There are a few text fields and a list of user input. There is nothing about opening an external file within the plugin context.

Alexandre
Posts: 151
Joined: Thu Dec 12, 2019 11:08 am

Re: How to open multiple external files within plugin executed in current spreadsheet context

Post by Alexandre » Fri Aug 14, 2020 3:49 pm

Hello Anthony.
Sorry if I misled you with my previous post. The plugin that is located at the link you specified is not yet complete. Work on it continues. Unfortunately, I cannot tell the exact time frames of the release of workable version of this plugin at the moment.

Sorry for the inconvenience.

antiai
Posts: 4
Joined: Mon Aug 10, 2020 8:05 pm

Re: How to open multiple external files within plugin executed in current spreadsheet context

Post by antiai » Fri Aug 14, 2020 6:48 pm

Ok, thank you for the information, Alexandre!

Post Reply