# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # # 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/. # # This file incorporates work covered by the following license notice: # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed # with this work for additional information regarding copyright # ownership. The ASF licenses this file to you under the Apache # License, Version 2.0 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at http://www.apache.org/licenses/LICENSE-2.0 . # # bootstrap uno component context import uno import unohelper from com.sun.star.lang import IllegalArgumentException # a UNO struct later needed to create a document from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK from com.sun.star.text.TextContentAnchorType import AS_CHARACTER from com.sun.star.awt import Size def insertTextIntoCell( table, cellName, text, color ): tableText = table.getCellByName( cellName ) cursor = tableText.createTextCursor() cursor.setPropertyValue( "CharColor", color ) tableText.setString( text ) localContext = uno.getComponentContext() resolver = localContext.ServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", localContext ) smgr = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ServiceManager" ) remoteContext = smgr.getPropertyValue( "DefaultContext" ) #remoteContext = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" ) #smgr = remoteContext.ServiceManager desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",remoteContext) # open a writer document doc = desktop.loadComponentFromURL( "private:factory/swriter","_blank", 0, () ) text = doc.Text cursor = text.createTextCursor() text.insertString( cursor, "The first line in the newly created text document.\n", 0 ) text.insertString( cursor, "Now we are in the second line\n" , 0 ) # create a text table table = doc.createInstance( "com.sun.star.text.TextTable" ) # with 4 rows and 4 columns table.initialize(4, 4) text.insertTextContent( cursor, table, 0 ) rows = table.Rows table.setPropertyValue( "BackTransparent", False ) table.setPropertyValue( "BackColor", 13421823 ) row = rows.getByIndex(0) row.setPropertyValue( "BackTransparent", False ) row.setPropertyValue( "BackColor", 6710932 ) textColor = 16777215 insertTextIntoCell( table, "A1", "FirstColumn", textColor ) insertTextIntoCell( table, "B1", "SecondColumn", textColor ) insertTextIntoCell( table, "C1", "ThirdColumn", textColor ) insertTextIntoCell( table, "D1", "SUM", textColor ) table.getCellByName("A2").setValue(22.5) table.getCellByName("B2").setValue(5615.3) table.getCellByName("C2").setValue(-2315.7) table.getCellByName("D2").setFormula("sum ") table.getCellByName("A3").setValue(21.5) table.getCellByName("B3").setValue(615.3) table.getCellByName("C3").setValue(-315.7) table.getCellByName("D3").setFormula("sum ") table.getCellByName("A4").setValue(121.5) table.getCellByName("B4").setValue(-615.3) table.getCellByName("C4").setValue(415.7) table.getCellByName("D4").setFormula("sum ") cursor.setPropertyValue( "CharColor", 255 ) cursor.setPropertyValue( "CharShadowed", True ) text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 ) text.insertString( cursor, " This is a colored Text - blue with shadow\n" , 0 ) text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 ) textFrame = doc.createInstance( "com.sun.star.text.TextFrame" ) textFrame.setSize( Size(15000,400)) textFrame.setPropertyValue( "AnchorType" , AS_CHARACTER ) text.insertTextContent( cursor, textFrame, 0 ) textInTextFrame = textFrame.getText() cursorInTextFrame = textInTextFrame.createTextCursor() textInTextFrame.insertString( cursorInTextFrame, "The first line in the newly created text frame.", 0 ) textInTextFrame.insertString( cursorInTextFrame, "\nWith this second line the height of the rame raises.",0) text.insertControlCharacter( cursor, PARAGRAPH_BREAK, 0 ) cursor.setPropertyValue( "CharColor", 65536 ) cursor.setPropertyValue( "CharShadowed", False ) text.insertString( cursor, " That's all for now!" , 0 ) # vim: set shiftwidth=4 softtabstop=4 expandtab: collabora/dcm-7.5 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-11-19tdf#124176 use pragma once instead of include guardsRoman Kuznetsov
in /core/include/svtools/ Change-Id: Ic8614f77dfde02f4c1fc4cceccd1de4ff5a05f72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106006 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-02-05tdf#42949 Fix IWYU warnings in include/svtools/*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I937ed12f2a96943664087ddcdd035f1347e84a57 Reviewed-on: https://gerrit.libreoffice.org/67102 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2017-03-17convert SvxBorderStyle to scoped enumNoel Grandin
and rename to SvxBorderLineStyle Change-Id: I19e530f162e4ca6290a0ad076e7fe3d5775ae6bc Reviewed-on: https://gerrit.libreoffice.org/35265 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2014-01-20Better pixelization of dashed lines for screen rendering.Kohei Yoshida
Now the dashed lines are evenly placed on screen. For now, horizontal lines only. I'll work on vertical lines later. Change-Id: I474e9c8214e5f079ea2cfca12b35381d8fcf2ae1
2014-01-17Apply dashing without consulting current map unit.Kohei Yoshida
Using scaling is sufficient. Change-Id: If976bec3940772432d814a77681170d7c99306d2
2013-11-09fdo#65108 inter-module includes <> include/svtoolsNorbert Thiebaud
Change-Id: I7e004e1e4fbc2141ff421af6be0e8bf5a026b189
2013-10-23fixincludeguards.sh: include/s*Thomas Arnhold
Change-Id: I57fcfd442d2b5815e7c07a9cbd660f3698168dee
2013-04-23execute move of global headersBjoern Michaelsen
see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a