Coder Social home page Coder Social logo

Comments (6)

askonev avatar askonev commented on July 18, 2024 1

@PranksterDr Hi! At the moment, an analogue of the Select object is not implemented in Spreeedsheets, so at the moment the implementation of copy and paste is possible using algorithms. Perhaps the ApiRange.ForEach method implementation will help you, allowing you to work comfortably with the cells of the selected area using callback. Also your solutions using this method will be sufficiently productive in view of the low-level optimization in the browser's JavaScript engine.

An article with js performance research methods.

A simple example of copying using ForEach

oSheet = Api.GetActiveSheet();
oRange = oSheet.GetRange('A1:C1');
numCurrentRow = 3;
    
oRange.ForEach(function(range) {
    
    oValue2 = range.GetValue2();
    numCol = range.GetCol();
    oCurrentRow = oSheet.GetRangeByNumber(numCurrentRow, numCol);
    oCurrentRow.SetValue(oValue2);
    
});

from onlyoffice.github.io.

ShockwaveNN avatar ShockwaveNN commented on July 18, 2024

Hi, could you describe in more details what you want to do?

You want to be able to copy some text to buffer and past in some other application?
I'm not sure if this possible, since we even have varning when you use Paste button about it working correctly only in current tab of Editors

from onlyoffice.github.io.

PranksterDr avatar PranksterDr commented on July 18, 2024

No. I try copy range and paste this range in other row with macros. Is it possible with JS into spreedsheet ? Ofcourse old valuei need save. (Я имею ввиду, что пытаюсь с помощью JS сделать дубликат строки. Т.е. мне необходимо создать пустую строку со сдвигом вниз и заполнить ее данными из предыдущей строки)

from onlyoffice.github.io.

PranksterDr avatar PranksterDr commented on July 18, 2024

Например VBA позволяет копировать и вставлять как ячейки, так и диапазоны и строки, и столбцы. Для этого есть метод Selection, который включает Copy и Paste. Можно конечно на JS сделать перебор всего массива и последующим сдвигом вниз всего массива. Но это очень ресурсоемкая операция.

from onlyoffice.github.io.

ShockwaveNN avatar ShockwaveNN commented on July 18, 2024

@askonev Please take a look at this issue, could you help to clarify that?

from onlyoffice.github.io.

PranksterDr avatar PranksterDr commented on July 18, 2024

@askonev Hey! Thanks for the answer ! I completed this task in the same way using a loop. But still, the copy and paste function is missing(sad). It will be very cool if it will appear in the next versions of the API. In my work I using a loop implemented a method for duplicating rows.

from onlyoffice.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.