| View previous topic :: View next topic |
| Author |
Message |
mitschel Newbie

Joined: 15 Jan 2004 Posts: 4
|
Posted: Thu Jan 15, 2004 1:15 am Post subject: saving text formats into DB |
|
|
Hi!
What i want to have :
i mark some text in the document with the mouse. than i want to execute a macro which saves me the text in a DB. so far there is no problem. i get a Cursor Object it from o.Doc.CurrentController.ViewCursor(). This Cursor object includes all information like string, font family, fontstyle,etc! but how can i save all this information in a db? is it possible to get the structure of the object as bank text, which i can save in a db and get it back later? my problem is to get all format information the marked text includes, so i can paste exactly the same from db.
thanks for help!
michael |
|
| Back to top |
|
 |
mitschel Newbie

Joined: 15 Jan 2004 Posts: 4
|
Posted: Mon Jan 19, 2004 2:24 am Post subject: |
|
|
| no ideas? it´s very important for me... |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
Posted: Mon Jan 19, 2004 5:10 am Post subject: |
|
|
I only copy and past Bernard Marcelly french documentation, add a print :
To print a selection with only one selection :
| Code: |
Sub Marcelly
Dim MonDocument As Object
Dim CurseurVisible As Object
Dim TexteDeLaSelection As String
MonDocument = ThisComponent
CurseurVisible = MonDocument.currentcontroller.ViewCursor
TexteDeLaSelection = CurseurVisible.String
print TexteDeLaSelection
'CurseurVisible.String = " nouveau texte "
End Sub
|
If your selection contains many text :
| Code: |
Sub Marcelly2
Dim MonDocument As Object
Dim LesSelections As Object
Dim selx As Integer, UneZone As Object
MonDocument = ThisComponent
LesSelections = MonDocument.CurrentSelection
for selx = 0 to LesSelections.Count -1
UneZone = LesSelections(selx)
rem mettre en gras chaque zone sélectionnée
print UneZone.string
' UneZone.CharWeight = com.sun.star.awt.FontWeight.BOLD
next
End Sub
|
This is the only beginning part for your problem but I have never used DB with OOo.
There is no problem to put this text in a 00oCalc sheet. _________________ Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide |
|
| Back to top |
|
 |
|