| View previous topic :: View next topic |
| Author |
Message |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Tue Feb 08, 2005 7:56 am Post subject: Re: Search and get the text, hyperlinkURL in a document |
|
|
| lsropia wrote: | | I have a problem. I have to make a document from large number of html files in a directory. |
You are likely to get the best result by posting your question as a new thread in the Macros and API section.
Someone else may already know how to do what you want.
Being a new question on its own thread, it is easy to discuss various detailed aspects of the overall problem.
I'll keep your question bookmarked. I'll come back to it if I find a solution or if I have time to develop a solution. _________________ Want to make OOo Drawings like the colored flower design to the left? |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
p00hba Newbie

Joined: 04 Apr 2006 Posts: 3
|
Posted: Tue Apr 04, 2006 8:45 am Post subject: DannyB is the Man! |
|
|
Yo DannyB, thx for all the writeups!  |
|
| Back to top |
|
 |
kog Newbie

Joined: 27 Apr 2006 Posts: 3
|
Posted: Thu Apr 27, 2006 10:08 pm Post subject: |
|
|
Does anyone know how to set the page orientation for a text document ?
Thanks,
kog |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
spotsy8a Newbie

Joined: 01 Aug 2006 Posts: 1 Location: Spain
|
Posted: Tue Aug 01, 2006 9:16 am Post subject: Re: Writer Examples |
|
|
Hi Danny, I'm very interesting in this code "Obtain a Writer document by either.... or Create a new one" and the consecutives steps that you have in this section"
But I have a problem, your code is in Visual Basic or Phyton, and I need in Java like in
http://www.oooforum.org/forum/viewtopic.phtml?t=19721&view=previous whit the name SimpleWriterExample.java, but only exist the creation of a new file, or the opening of an existing file.
My question is the next, Do you have the others points implemented in Java???
I refer to 2,3,4,5,6 whit clauses.
I saw you last works like CalcExamples.java, and is very easy work whit this file, some like this, Dou you have for Writer?????
Thanks a lot, And I hope your response. Or someone else to want to answer.
[quote="DannyB"]This is a short example program which shows how to...
1. Obtain a Writer document by either....
1A. Create a new one
1B. Open one from disk (both Linux and Windows examples), including loading a Word or RTF file.
1C. Access the current Writer document, assuming that this macro is embedded into a Writer document rather than some other type of document.
1D. Access the frontmost window, which must be a Writer document.
2. Put some content into the document.
2A. Changing the style of a paragraph.
2B. Moving the cursor within a document.
3. Print the document three different ways...
3A. Simple printing via. the API.
3B. Printing via. the API, but with some arguments.
3C. Using the dispatcher to print by displaying the pring job dialog box.
4. Save the Writer document in native OOo format.
5. Export the Writer document to...
* Word
* PDF
* RTF
* HTML
6. Close the document.
This example can serve as a companion to my similar example article for the Calc spreadsheet, which can be found here...
http://www.oooforum.org/forum/viewtopic.php?t=4996
 _________________ José Luis O. |
|
| Back to top |
|
 |
gidi General User

Joined: 14 Aug 2005 Posts: 5
|
Posted: Tue Aug 28, 2007 6:30 am Post subject: |
|
|
Hi Danny,
I hope you can help me...
I've a C# application, and i need to open a document (writer) and then replace text in it (replace Text1 with NewText for example).
and then i want to print it.
while doing it, i don't want the user to see that the writer was open (meaning to do all of this in hidden mode).
here is my code which i got from one of the guys here in the forum,
XComponentContext xComponentContext = Connector.GetComponentContext();
XMultiServiceFactory xMultiServiceFactory = Connector.GetMultiServiceFactory(xComponentContext);
XDesktop xDesktop = Connector.GetDesktop(xMultiServiceFactory);
string myFileToPrint = OpenOfficeLib.Document.Component.PathConverter(letter_loc_txt.Text);
XComponent xComponent = OpenOfficeLib.Document.Component.LoadDocument(
(XComponentLoader)xDesktop, myFileToPrint, "_blank");
hope you can help me,
Thanks,
Gidi |
|
| Back to top |
|
 |
pauliv_de General User


Joined: 31 Aug 2007 Posts: 12 Location: Germany, Enger
|
Posted: Wed Apr 16, 2008 4:49 am Post subject: |
|
|
I was looking for an example how to insert an image into a tablecell, and I found it - thanks very much to Danny. But a have a problem and I didn't find a solution until now.
I want to know the size of the inserted image then I want to rescale it to specific needs and then write this new size into a cell of the table
So I inserted some lines of code....
| Code: |
Sub PutImageIntoCell( oDoc, oTable, nCol, nRow, cImageUrl )
' Create an image.
oImage = oDoc.createInstance( "com.sun.star.text.GraphicObject" )
oImage.GraphicURL = cImageUrl
oImage.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER
oCell = oTable.getCellByPosition( nCol, nRow )
' Get the Text of the cell.
' After this line, you can do many things with oText,
' just as if it were the text of the main document.
oText = oCell.getText()
oCursor = oText.createTextCursor()
oText.insertTextContent( oCursor, oImage, False )
'-------------------------------------------------------------------------------------
'--- additional lines start hereafter
'--- what is the size of the image ?
'-------------------------------------------------------------------------------------
msgbox oImage.getName() ' what happens here, if I comment this line out ?????
dim oImageSize as new com.sun.star.awt.Size
oImageSize = oImage.GetSize()
msgbox " oImageSize width : " & oImageSize.width & chr(10) &_
" oImageSize height : " & oImageSize.height, 0, " oImageSize"
oImageSize.width = oImageSize.width * 1.5
oImageSize.height= oImageSize.height* 1.5
oImage.setSize(oImageSize)
'------------------------------------------------------------------------------------
PutTextIntoCell( oDoc, oTable, nCol, nRow, "width:" & oImageSize.width &_
chr(10) & "height:" & oImageSize.height & chr(10))
End Sub
Sub PutTextIntoCell( oDoc, oTable, nCol, nRow, cText )
oCell = oTable.getCellByPosition( nCol, nRow )
oText = oCell.getText()
oCursor = oText.createTextCursor()
oText.insertString(oCursor, cText ,FALSE)
End Sub
|
This works fine until I have a look at the name of the image via msgbox ...
But if I do a comment at the msgbox-line
| Code: |
'msgbox oImage.getName()
|
then I always get a size of 566 ! (*1.5 = 849)
But why ?
I cannot find my mistake, hopefully somebody can give me a hint.
Thanks in advance
Paul |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|