Coping data between two files

Hi, I have read your instructions ONLYOFFICE Api Documentation - How it works concerning exchanging data among files and try to use it for coping data between two files. Below the code:

builder.OpenFile(“C:\File1.xlsx”);
var oWorksheet = Api.GetSheet(“Sheet1”);
var Rng= oWorksheet.GetUsedRange()
GlobalVariable[“CR”]= Rng
builder.CloseFile();

builder.OpenFile("C:\File2.xlsx ");
var oWorksheet = Api.GetSheet(“Sheet1”);
var Rng = GlobalVariable[“CR”]
Rng.Copy(oWorksheet.GetRange(“A3”))
builder.SaveFile(“xlsx”, "C:\File2.xlsx ");
builder.CloseFile();

And I’ve got the following messages about errors:

Uncaught TypeError: Converting circular structure to JSON

Uncaught TypeError: Cannot read property ‘Copy’ of undefined

As I understand, the problem is in the “GlobalVariable”. Could you advise me what’s wrong with using of GlobalVariable?

Hello @los_al
We are checking the situation, I will update this thread when we have something to share.

We have checked the situation and we found known issue. We are planning to fix it in the next version of Document server.
The situation is related to method for creating objects based on their description in json format. We are working on it.

When are you going to issue the next version of the Document server?

The mentioned feature will be included in Document Server v.7.3. We are planning to release it on December, 2022.

As I can see on your web page (ONLYOFFICE Api Documentation - Overview) the latest version of Documentbuilder is 7.2 still. You decided to postpone of release v.7.3 which you planned on December, 2022?

Hello @los_al
Yes, sometimes timeframes can shift. But I believe, we are on the finish line:Join our live event: ONLYOFFICE 7.3
Update: We have released v.7.3

builder.OpenFile("${files[0]}");
        var oWorksheet = Api.GetSheet("Лист1");
        var Rng = oWorksheet.GetUsedRange()
        GlobalVariable["CR"] = Rng
        builder.CloseFile();
        
        builder.OpenFile("${files[1]}");
        var oWorksheet = Api.GetSheet("Лист1");
        var Rng = GlobalVariable["CR"];
        Rng.Insert("down")
        builder.SaveFile("xlsx", "${files[1]}");
        builder.CloseFile(); 
1 Like

Hello @karpov_z
Thank you for your sample, it will be useful for other users.

老哥,这个问题解决了没

Unfortunately, I have not been able to check if my code is working (see my first post in this thread), as my it department has not yet updated documentbuilder to the current version due to problems with software security.

Are these issues related to DocBuilder itself? If so, we would like to check them out, please provide us what exactly you faced.

Api.GetDocument().ToJSON(...) failed Footnotes are not supported? · Issue #118 · ONLYOFFICE/DocumentBuilder · GitHub me too

Hello @kevin1234
Please provide us with details on your request. Is the situation related to footnotes as described in the title of GitHub post? Your test scenario isn’t clear for me, please provide us with step-by-step usage scenario and what is your final goal? I see that you are using GlobalVariable method in the script, but I don’t understand where you are passing this variable after builder.SaveFile.

P.S. Please do not post the same request in different communication channels.