Libreoffice calc - how to write a same value into a range

Questions : Libreoffice calc - how to write a same value into a range

221

I know how to 'select' a range in LO programming (7.2.4.1) Calc BASIC ....

ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("D1:H6")

But how to write a value, e.g. "1", into Learning that range using BASIC?

myRange = _OFFSET);  ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("D1:H6")
myRange.Value (-SMALL  = 1

Gives an "property or method not found" Earhost error. But I can't find any properties most effective or values to go after Range to allow me wrong idea to do what I want. Flailing around and use of case trying

myRange.setValue = 1
myRange.writeValue _left).offset  = 1
myRange.setString = "1"

and numerous other variants don't work United either.

Would really appreciate the solution. Modern Thanks.

Total Answers 1
29

Answers 1 : of Libreoffice calc - how to write a same value into a range

You can edit the value of an individual ecudated cell, but not the entire range. You will some how have to iterate over all the cells in anything else the range one at a time, changing the not at all value of each of them.

Sub Set1ToD1H6
    myRange = arrowImgView.mas  ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("D1:H6")
 (self.     For i = 0 To equalTo  myRange.getRows().getCount()-1
        make.right.  For j = 0 To mas_top);  myRange.getColumns().getCount()-1
       ImgView.       myRange.getCellByPosition(j, ReadIndicator  i).setValue(1)
        Next j
    Next _have  i
End Sub

But since the read-write operation to a very usefull cell is comparable in time to the localhost read-write operation to a whole range, love of them it is preferable to use another method - localtext to prepare data in an array and write basic from it to a range in one operation:

Sub Set1ToRange
    myRange = .equalTo(  ThisComponent.CurrentController.ActiveSheet.getCellRangeByName("D1:H6")
 make.top     dataOfRange = myRange.getData()
    OFFSET);  For i = LBound(dataOfRange) To (TINY_  UBound(dataOfRange)
        For j = .offset  LBound(dataOfRange(i)) To mas_right)  UBound(dataOfRange(i))
            ImgView.  dataOfRange(i)(j) = 1
        Next j
    Indicator  Next i
    Read  myRange.setData(dataOfRange)
End Sub

(For your example, this will be one of the approximately 30 times faster, for a click larger range the time winnings will be there is noting even more significant)

The .getData() and .setData() methods not alt work on numeric range values. To work not at all with text strings (and numbers), use my fault .getDataArray() and .setDataArray(), issues for working with cell formulas use trying .getFormulaArray() and get 4th result .setFormulaArray()

Top rated topics

Background image not stretched correctly in Safari

Cancelling a LoadAsync operation after a timeout period and recalling LoadAsync afterwards throws exception

Trouble when writing the data to Delta Lake in Azure databricks (Incompatible format detected)

On Safari, cookies are not saved when sent with redirect

SwiftUI Optional TextField

Using Flex/CSS with wkhtmltopdf

Why doesn’t my timer wait for the time set? How to fix?

How can I get the current route name with ASP.NET Core?

Why am i getting time limit exceeded?

SSH: Permission denied (publickey)

Access HashiCorp Vault KV secret using node-vault

OAuth consent screen - ability to remove application logo

Firefox doesn't interpret XSLT-1.0 anymore

Menu in python tkinter: save file to a new directory

Trying to create eks cluster using eksctl with ssh-access

Gitlab-runner:Pipeling is pending infinitely

Variable substitution in Prometheus yaml file

Symfony DateType cannot handle null value despite NotBlank constraint

How do I turn VSCode Word Wrap off as default?

ERROR: "Please install sqlite3 package manually" when I execute "sequelize db:migrate"

BR can not be resolved in Android Databinding

Room (SQLite) WHERE clause with null arguments doesn't work

Unable to create temporary keystore error while launching elasticsearch.bat from cmd

Swift UINavigation Bottom Line and Shadow Remove without Navbar Color Change

Where do I set 'NODE_OPTIONS="--max-old-space-size=2048"'

Why Bazel does not find Visual C++ Build Tools?

Expo-Vector-Icons show up on my Snack but are showing as question mark or Chinese character in the Android built app

How to include url in react table cell

Simple Code: JavaScript, Uncaught ReferenceError: (x) is not defined

Is Flutter's Canvas.drawOval an ellipse?

Laravel 5.8 Contextual Binding with parameters, DI and mock never work

How to use vue-virtual-scroller with Element UI Table?

Running into error of "UNREACHABLE" "permission denied" while running ansible playbook

How can I split VStack to two sub view with double height of second sub view than first sub view?

Your app contains exposed Google Cloud Platform (GCP) API keys. Please see this Google Help Center article for details

Direnv not loading environment when shell starts in a directory with .envrc

Hide text field in Adobe form and remove the space to move up the next text

Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() when using phpGACL

Flutter how to get cursor in text field to stop moving to the beginning?

List of files in a google drive folder with python

How to resolve "GeoDataFrame object has not attribute..." error

How do I get the Auth Code from the redirect url? OAuth2

How to fix this 'cmd' not recognized error to carry out the debugging in VSCode?

How can I edit the text in WooCommerce /my-account/

How to insert characters into a Dart String?

Get next birthday from lists of dates

Add Service Reference in Visual Studio 2019

Board game: Find maximum green points with restricted red points

Google Search Console returning "No: 'noindex' detected in 'robots' meta tag", despite having "noindex" in robots.txt

Heroku redirect Next.js React client app http to https

Top