File: SetText.bsh

package info (click to toggle)
libreoffice 4%3A7.5.9~rc1-1~bpo12%2B2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 3,821,240 kB
  • sloc: cpp: 4,237,093; xml: 452,501; java: 273,615; python: 73,913; ansic: 36,563; perl: 30,758; javascript: 18,231; sh: 11,590; makefile: 9,566; yacc: 8,527; cs: 6,703; objc: 1,969; lex: 1,378; asm: 1,220; awk: 986; pascal: 940; php: 79; csh: 20; sed: 5
file content (21 lines) | stat: -rw-r--r-- 666 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

import com.sun.star.uno.UnoRuntime;
import com.sun.star.frame.XModel;

import com.sun.star.text.XTextDocument;

oDoc = UnoRuntime.queryInterface(XModel.class,XSCRIPTCONTEXT.getInvocationContext());
if ( oDoc == null )
  oDoc = XSCRIPTCONTEXT.getDocument();

xTextDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,oDoc);
xTextDoc.getText().setString("Hello from Beanshell!");

return 0;