| View previous topic :: View next topic |
| Author |
Message |
lizinator General User

Joined: 02 Jul 2004 Posts: 11
|
Posted: Mon Jul 12, 2004 5:43 am Post subject: Turning linked images into embedded images in oo |
|
|
I spent quite a bit of time learning the api so I could convert html into word documents using the api, but unfortunately as I can see on a note further down, no one ever addresses the fact that when you convert directly from html to anything else, the images will always be linked as urls. Unless you plan on zipping up the images with the word file, you can't get it to work in openoffice! (easily)
So having done all the work to get that far anyways, I wrote in c++ a method of linking all the images in a document. I'd like to say it works, but it manages to crash openoffice if there are more than say 20 images. I have no idea why and I don't think it is my fault, but I figured I'd post the code here as a last act of desperation in case someone can see an error I can't see. In the end it may help some other poor soul get over this hump in the future.
And if anyone can see a better way to do this, please let me know.
Basically, this function opens a document (in this case a word document), iterates through the images in the file, and uses a dispatch to link the images and change the style of the anchor for them.
| Code: |
void linkImages() {
OUString sConnectionString(RTL_CONSTASCII_USTRINGPARAM("uno:socket,host=localhost, port=8100;urp;StarOffice.ServiceManager"));
Reference< XSimpleRegistry > xSimpleRegistry(
cppu::createSimpleRegistry());
xSimpleRegistry->open( OUString( RTL_CONSTASCII_USTRINGPARAM(
"html2pdfdoc.rdb") ), sal_True, sal_False );
Reference< XComponentContext > xComponentContext(
cppu::bootstrap_InitialComponentContext( xSimpleRegistry ) );
Reference< XMultiComponentFactory > xMultiComponentFactoryClient(
xComponentContext->getServiceManager() );
//xMultiComponentFactoryClient is remote service manager
Reference< XInterface > xInterface =
xMultiComponentFactoryClient->createInstanceWithContext(
OUString::createFromAscii( "com.sun.star.bridge.UnoUrlResolver" ),
xComponentContext );
Reference< XUnoUrlResolver > resolver( xInterface, UNO_QUERY );
try
{
xInterface = Reference< XInterface >(
resolver->resolve( sConnectionString ), UNO_QU catch ( Exception& e )
{
printf("Error: cannot establish a connection using '%s':\n %s\n",
OUStringToOString(sConnectionString, RTL_TEXTENCODING_ASCII_US).getStr(),
OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US).getStr());
exit(1);
}
Reference< XPropertySet > xPropSet( xInterface, UNO_QUERY );
xPropSet->getPropertyValue( OUString::createFromAscii("DefaultContext") ) >>= xComponentContext;
Reference< XMultiComponentFactory > xMultiComponentFactoryServer(
xComponentContext->getServiceManager() );
Reference < XComponentLoader > xComponentLoader(
xMultiComponentFactoryServer->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ) ),
xComponentContext ), UNO_QUERY );
OUString sDocUrl;
char *stringDocumentName = strdup("file:///filedir/file.doc");
sDocUrl=OUString::createFromAscii(stringDocumentName);
printf("c\n");
printf("Opening:'%s'\n",
rtl::OUStringToOString(sDocUrl, RTL_TEXTENCODING_ASCII_US).getStr());
Sequence< PropertyValue> loadprops(1);
loadprops[0].Name=OUString::createFromAscii("Hidden");
loadprops[0].Value <<= sal_False;
Reference<XComponent> xComponent=xComponentLoader->loadComponentFromURL(
sDocUrl,
OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")),
0,
loadprops);
Reference < XDispatchHelper > xDispatchHelper(
xMultiComponentFactoryServer->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.DispatchHelper")),
xComponentContext ), UNO_QUERY );
Reference < XModel > xModel(xComponent, UNO_QUERY );
Reference <XController> xController = xModel->getCurrentController();
Reference <XFrame> xFrame = xController->getFrame();
Reference <XDispatchProvider> xDispatchProvider(xFrame, UNO_QUERY);
Reference<XTextGraphicObjectsSupplier> xGraphicsSupplier(xComponent, UNO_QUERY);
Reference<XNameAccess> xNameAccess = NULL;
xNameAccess=xGraphicsSupplier->getGraphicObjects();
Reference<XIndexAccess> xIndexAccess(xNameAccess,UNO_QUERY);
Reference<XTextViewCursorSupplier> xTextViewCursorSupplier(xController, UNO_QUERY);
Reference<XTextViewCursor> xTextViewCursor = NULL;
int count = xIndexAccess->getCount();
for (int i=0; i<count; i++) {
static int num=0;
Reference<XTextContent> graphic(xIndexAccess->getByIndex(i),UNO_QUERY);
Reference<XPropertySet> graphUrlProp(graphic, UNO_QUERY);
OUString url;
Reference<XTextRange> urlPos;
graphUrlProp->getPropertyValue(OUString::createFromAscii("GraphicURL")) >>= url;
urlPos=graphic->getAnchor();
xTextViewCursor = xTextViewCursorSupplier->getViewCursor();
printf("%i:url:%s\n",num++,rtl::OUStringToOString(url,RTL_TEXTENCODING_ASCII_US). getStr());
if (strncmp(rtl::OUStringToOString(url,RTL_TEXTENCODING_ASCII_US),"file://",7)!=0) {
printf("skipping due to non-local url\n");
continue;
}
xTextViewCursor->gotoRange(urlPos, sal_False);
graphic->dispose();
Sequence <PropertyValue >dispProps(5);
dispProps[0].Name= OUString::createFromAscii("FileName");
dispProps[0].Value <<= url;
dispProps[3].Name=OUString::createFromAscii("AsLink");
dispProps[3].Value <<= sal_False;
dispProps[2].Name=OUString::createFromAscii("Style");
dispProps[2].Value <<= OUString::createFromAscii("Graphics");
dispProps[1].Name=OUString::createFromAscii("FilterName");
dispProps[1].Value <<= OUString::createFromAscii("<All Formats>");
xDispatchHelper->executeDispatch(xDispatchProvider, OUString::createFromAscii(".uno: InsertGraphic"),OUString::createFromAscii(""),0,dispProps);
xDispatchHelper->executeDispatch(xDispatchProvider, OUString::createFromAscii(".uno: SetAnchorToChar"),OUString::createFromAscii(""),0,Sequence<PropertyValue>());
}
} |
|
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Mon Jul 12, 2004 12:37 pm Post subject: |
|
|
Does this still crash if the document is NOT loaded as hidden? This may affect the ability of the dispatch to function. If this does not help, then I recommend you attempt (strictly as a test measure) placing a delay after the dispatch of roughly five seconds. Again, this is ONLY as a test to see if it makes a difference. _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
lizinator General User

Joined: 02 Jul 2004 Posts: 11
|
Posted: Tue Jul 13, 2004 12:15 pm Post subject: |
|
|
Yeah, it crashes whether hidden or not. When visible, you can see it performing the operations like a dream ... for a couple seconds and then it freaks out. I don't know why or how to get around it. The only thing I haven't tried is converting it to another language.
And off topic, I read through your oo macros last week, very good stuff. Clarified a lot of things. |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Tue Jul 13, 2004 8:15 pm Post subject: |
|
|
Thanks for your kind words regarding my macro document. The book is even better . A few sample chapters will be available for free. Most noteably, for your purposes, Chapter 1 should be available. It is not yet up, so I can not provide a direct link to it yet . I hear that it has already shipped so the link should be up already. Soon, very soon...
I think that the behavior is very interesting. I would like to know if the "bad" behavior is also present from Basic.
I started to write the macro in Basic, and then it occured to me that I had already done similar things in section 7.15.3 of my macro document. Can I embed or link a graphics object? Of course, I do not use a dispatch to accomplish this.
I wonder a bit about the dispose statement. Hmmm. Perhaps removeTextContent might be safer in the long run.
Does this always crash on the same image? _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
lizinator General User

Joined: 02 Jul 2004 Posts: 11
|
Posted: Wed Jul 14, 2004 7:21 am Post subject: |
|
|
There is a small error in what I did above. Whenever I make a call to dispose, it apparently changes the XIndexAccess such that it lowers the count by one. As such if there were 34 images in the document, this will crash on the 18th one every time, since after it deletes 17 images, it tries to access an 18th and dispose of it, which doesn't exist. Nonetheless when I corrected this code, it still manages to crash OO at a random location during the dispatch uno:InsertGrahpic calls anyways.
I read over that section of your document again. I skipped over it originally because it dealt with GraphicObjectShapes instead of TextGraphicObjects.
Basically its impossible to insert TextGraphicObjects through the api by any method other than dispatch (it says so in the developer's guide), which is what I tried above. Since what I did above causes OO to crash randomly, obviously that's not a solution.
I'll try to do what you did in your document. I really hope this works. |
|
| Back to top |
|
 |
lizinator General User

Joined: 02 Jul 2004 Posts: 11
|
Posted: Thu Jul 15, 2004 10:31 am Post subject: |
|
|
Ok I attempted to recreate section 7.15.3 from your macro document but I'm not having any success.
You say:
REM You can also insert this as text content if you desire.
ThisComponent.Drawpage.add(oGraph)
But xText->insertTextContent() will not accept anything but XContent and XShape is not XContent.
God I just wish someone had written an insertTextContentEmbedded() function and all this time would not have been wasted.  |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Thu Jul 15, 2004 11:57 am Post subject: |
|
|
lizinator:
I have written an example how to insert a TextGraphicsObject.
It can be found in AndrewPitonyak's document under 5.10 .
About your previous post:
| Quote: |
There is a small error in what I did above. Whenever I make a call to dispose, it apparently changes the XIndexAccess such that it lowers the count by one.
|
Don't use .dispose() to remove textcontents, as you stated the XIndexAccess will be affected by it.
Instead use .removeTextContent() which should work better.
I remember that we had this discussion either in the dev-api mailinglist or here somewhere in the forum, but I don't know where it is anymore.
Hope that helps.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
lizinator General User

Joined: 02 Jul 2004 Posts: 11
|
Posted: Thu Jul 15, 2004 12:21 pm Post subject: |
|
|
Yes, that is the procedure I tried to recreate in C++ but I couldn't get it to work as is.
| Code: |
oGraphic = oDoc.createInstance("com.sun.star.text.GraphicObject")
With oGraphic
.GraphicURL = ConvertToURL( <filename> )
.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER
.Width = 3000
.Height = 3000
End With
'now insert the image into the text document
oText.insertTextContent( oCursor, oGraphic, False )
|
But when I try this directly in C++ as so:
| Code: |
Reference<XShape> oGraph(xFactory->createInstance(OUString::createFromAscii("com.sun.star.drawing.GraphicObject")), UNO_QUERY);
Reference<XPropertySet> oGraphProps(oGraph, UNO_QUERY);
Any val;
val <<= url;
oGraphProps->setPropertyValue(OUString::createFromAscii("GraphicURL"),val);
xText->insertTextContent(urlPos,oGraph,sal_False);
|
Generates the error:
html2doc.cxx:323: error: no matching function for call to `
com::sun::star::text::XText::insertTextContent(
com::sun::star::uno::Reference<com::sun::star::text::XTextRange>&,
com::sun::star::uno::Reference<com::sun::star::drawing::XShape>&, unsigned
char)'
inc/com/sun/star/text/XText.hdl:54: error: candidates are: virtual void
com::sun::star::text::XText::insertTextContent(const
com::sun::star::uno::Reference<com::sun::star::text::XTextRange>&, const
com::sun::star::uno::Reference<com::sun::star::text::XTextContent>&,
unsigned char)
I also tried this, which compiles, but aborts abnormally on the insert statement, even though the objects all pass a .is() check.
| Code: |
Reference<XShape> oGraph(xFactory->createInstance(OUString::createFromAscii("com.sun.star.drawing.GraphicObjectShape")), UNO_QUERY);
Reference<XTextContent> oGraphTC(oGraph, UNO_QUERY);
Reference<XPropertySet> oGraphProps(oGraphTC, UNO_QUERY);
Any val;
val <<= url;
oGraphProps->setPropertyValue(OUString::createFromAscii("GraphicURL"),val);
xText->insertTextContent(urlPos,oGraphTC,sal_False);
|
I also tried to set properties on oGraph but that doesn't seem to make a difference. The URL I'm passing in is definitely valid. The urlPos is from a getAnchor of another image so I know that is valid.
I'm sorry if this is this is a really newbie mistake that I'm sure it is. If I could use oobasic for this I would in a heartbeat. |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Thu Jul 15, 2004 7:48 pm Post subject: |
|
|
I think that you are not committing a newbie mistake! I did some investigations using OOo 1.1.2 and it looks to me like the com.sun.star.text.GraphicObject is no longer supported. Someone, please tell me that I am mistaken on this. First, I ran a simple little test to see what document can create...
| Code: | Dim s As String
Dim i As Integer
Dim x
x = ThisComponent.getAvailableServiceNames()
For i=LBound(x) To UBOUnd(x)
s = s & x(i) & CHR$(10)
If ((i MOD 30) = 29) Then
MsgBox s
s = ""
End If
Next
MsgBox s
|
No wonder it refused to create what I wanted. I think that this worked in 1.1.1. At least, I can say that this is demonstrated in the Developer's Guide. http://api.openoffice.org/docs/DevelopersGuide/BasicAndDialogs/BasicAndDialogs.htm
That said, it looks like the "com.sun.star.drawing.GraphicObjectShape" service is supported, so you may have to figure out how to use that instead. Arggggggg!
Now that I have rambled a bit on how things appear to be changing in ways that are not expected by me! Let me point out that this shape object supports the following interfaces:
com.sun.star.beans.XMultiPropertySet
com.sun.star.beans.XPropertySet
com.sun.star.beans.XPropertyState
com.sun.star.container.XChild
com.sun.star.container.XElementAccess
com.sun.star.container.XEnumerationAccess
com.sun.star.container.XNamed
com.sun.star.drawing.XGluePointsSupplier
com.sun.star.drawing.XShape
com.sun.star.drawing.XShapeDescriptor
com.sun.star.lang.XComponent
com.sun.star.lang.XServiceInfo
com.sun.star.lang.XTypeProvider
com.sun.star.lang.XUnoTunnel
com.sun.star.text.XSimpleText
com.sun.star.text.XText
com.sun.star.text.XTextContent
com.sun.star.text.XTextRange
com.sun.star.text.XTextRangeMover
Now, look at the error that you have.
| Quote: | html2doc.cxx:323: error: no matching function for call to `
com::sun::star::text::XText::insertTextContent(
com::sun::star::uno::Reference<com::sun::star::text::XTextRange>&,
com::sun::star::uno::Reference<com::sun::star::drawing::XShape>&, unsigned
char)'
inc/com/sun/star/text/XText.hdl:54: error: candidates are: virtual void
com::sun::star::text::XText::insertTextContent(const
com::sun::star::uno::Reference<com::sun::star::text::XTextRange>&, const
com::sun::star::uno::Reference<com::sun::star::text::XTextContent>&,
unsigned char) |
All that you have to do is to obtain the XTextContent interface and then use that  _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Thu Jul 15, 2004 8:03 pm Post subject: |
|
|
Oops, my mistake. When I was trying to create a text object, I was running from a module contained in a Calc document
Of course, the text object shape appears to be NOT documented in the API documentation. <sigh>. _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
lizinator General User

Joined: 02 Jul 2004 Posts: 11
|
Posted: Fri Jul 16, 2004 7:04 am Post subject: |
|
|
I did pull an xcontent interface from the graphicobjectshape and inserted it into the document, but it would abort abnormally afterwards. I think I found the reason why.
If the old image is inside a table (and all of mine are), it is not pulled into a xtextdocument->getText() call and therefore when you try to xText->insertTextContent with a new graphic at the getAnchor of the old image, it aborts abnormally because that xtext doesn't contain that anchor (it doesn't contain anything that is inside the table.
That means in order to finish this I now have to search for tables, then search each cell of each table for images and then change them. sigh. |
|
| Back to top |
|
 |
lizinator General User

Joined: 02 Jul 2004 Posts: 11
|
Posted: Fri Jul 16, 2004 7:12 am Post subject: |
|
|
Nevermind I just thought of a much better idea.
instead of xText->insertTextContent(oldGraphic->getAnchor(),newgraphic,false);
I'll do
oldGraphic->getAnchor()->getText()->insertTextContent(oldGraphic->getAnchor,newgraphic,false); |
|
| Back to top |
|
 |
lizinator General User

Joined: 02 Jul 2004 Posts: 11
|
Posted: Fri Jul 16, 2004 12:18 pm Post subject: |
|
|
Ok here is my final function for those interested.
It takes a document, searches for linked images, creates a new graphicobjectshape with a url from that image, then makes another graphicobjectshape and copies the data over from the first graphicobjectshape, then it sets the url of the original image to that of the second graphicobjectshape. Thereby embedding the image permanently in the document while losing as little formatting as possible. And yes I realize this could be a bit crisper, but its friday and I think I'll just take a nap instead.
| Code: |
void convertAndEmbedImages(char *filename, char *savename,
char *initialformat, char *saveformat) {
OUString sConnectionString(RTL_CONSTASCII_USTRINGPARAM("uno:socket, host=localhost,port=8100;urp;StarOffice.ServiceManager"));
Reference< XSimpleRegistry > xSimpleRegistry(
cppu::createSimpleRegistry());
xSimpleRegistry->open( OUString( RTL_CONSTASCII_USTRINGPARAM(
"html2pdfdoc.rdb") ), sal_True, sal_False );
Reference< XComponentContext > xComponentContext(
cppu::bootstrap_InitialComponentContext( xSimpleRegistry ) );
Reference< XMultiComponentFactory > xMultiComponentFactoryClient(
xComponentContext->getServiceManager() );
Reference< XInterface > xInterface =
xMultiComponentFactoryClient->createInstanceWithContext(
OUString::createFromAscii( "com.sun.star.bridge.UnoUrlResolver" ),
xComponentContext );
Reference< XUnoUrlResolver > resolver( xInterface, UNO_QUERY );
try
{
xInterface = Reference< XInterface >( resolver->resolve( sConnectionString ), UNO_QUERY );
}
catch ( Exception& e )
{
printf("Error: cannot establish a connection using '%s':\n %s\n",
OUStringToOString(sConnectionString, RTL_TEXTENCODING_ASCII_US). getStr(),
OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US). getStr());
exit(1);
}
Reference< XPropertySet > xPropSet( xInterface, UNO_QUERY );
xPropSet->getPropertyValue( OUString::createFromAscii("DefaultContext") ) >>= xComponentContext;
//xMultiComponentFactoryServer is remote service manager
Reference< XMultiComponentFactory > xMultiComponentFactoryServer(
xComponentContext->getServiceManager() );
Reference < XComponentLoader > xComponentLoader(
xMultiComponentFactoryServer->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ) ),
xComponentContext ), UNO_QUERY );
//LOAD DOCUMENT
OUString sDocUrl;
sDocUrl=getPath(filename);
printf("Opening:'%s'\n",
rtl::OUStringToOString(sDocUrl, RTL_TEXTENCODING_ASCII_US). getStr());
Sequence< PropertyValue> loadprops(2);
loadprops[0].Name=OUString::createFromAscii("Hidden");
loadprops[0].Value <<= sal_False;
loadprops[1].Name=OUString::createFromAscii("FilterName");
loadprops[1].Value <<= OUString::createFromAscii(initialformat);
printf("d\n");
Reference<XComponent> xComponent=xComponentLoader->loadComponentFromURL(
sDocUrl,
OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")),
0,
loadprops);
printf("e\n");
//FIND ALL GRAPHIC OBJECTS IN THIS DOCUMENT
Reference<XTextGraphicObjectsSupplier> xGraphicsSupplier(xComponent, UNO_QUERY);
Reference<XNameAccess> xNameAccess = NULL;
Reference<XMultiServiceFactory> xFactory(xComponent,UNO_QUERY);
if (!xFactory.is()) printf("xFactoryisn't\n");
while (1) {
static int num=0;
int done=0;
OUString url;
xNameAccess=xGraphicsSupplier->getGraphicObjects();
Reference<XIndexAccess> xIndexAccess(xNameAccess,UNO_QUERY);
int j=0;
while (1) {
if (j>=xIndexAccess->getCount()) {
done=1;
break;
}
Reference<XTextContent> agraphic(xIndexAccess->getByIndex(j),UNO_QUERY);
Reference<XPropertySet> graphUrlProp(agraphic, UNO_QUERY);
graphUrlProp->getPropertyValue(OUString::createFromAscii("GraphicURL")) >>= url;
if (url!=NULL && strncmp(rtl::OUStringToOString(url,RTL_TEXTENCODING_ASCII_US),"file://",7)==0) {
break;
}
j++;
}
if (done==1) break;
printf("%i:url:%s\n",num++,
rtl::OUStringToOString(url,RTL_TEXTENCODING_ASCII_US).getStr());
Reference<XTextContent> graphic(xIndexAccess->getByIndex(j),UNO_QUERY);
Reference<XTextRange> urlPos = graphic->getAnchor();
Reference<XShape> tempGraphObj(xFactory->createInstance(OUString:: createFromAscii("com.sun.star.drawing.GraphicObjectShape")),UNO_QUERY);
Reference<XPropertySet> graphicProps(graphic, UNO_QUERY);
Reference<XPropertySet> tempGraphObjProps(tempGraphObj, UNO_QUERY);
Any val;
val <<= url;
tempGraphObjProps->setPropertyValue(OUString::createFromAscii("GraphicURL"),val);
Reference<XTextContent> tempGraphObjTC(tempGraphObj, UNO_QUERY);
urlPos->getText()->insertTextContent(urlPos,tempGraphObjTC,sal_False);
Reference<XShape> tempGraphObj2(xFactory->createInstance(OUString:: createFromAscii("com.sun.star.drawing.GraphicObjectShape" )),UNO_QUERY);
Reference<XTextContent> tempGraphObj2TC(tempGraphObj2, UNO_QUERY);
Reference<XPropertySet> tempGraphObj2Props(tempGraphObj2, UNO_QUERY);
//Fill second temporary graphic object with data from first, but not url
//which causes it to make a new one.
tempGraphObj2Props->setPropertyValue(OUString:: createFromAscii("GraphicObjectFillBitmap"),tempGraphObjProps- >getPropertyValue(OUString::createFromAscii("GraphicObjectFillBitmap")));
//There! As of this insert, we now have an embedded url we can use.
urlPos->getText()->insertTextContent(urlPos,tempGraphObj2TC,sal_False);
urlPos->getText()->removeTextContent(tempGraphObjTC);
graphicProps->setPropertyValue(OUString::createFromAscii("GraphicURL"), tempGraphObj2Props->getPropertyValue(OUString::createFromAscii("GraphicURL")));
urlPos->getText()->removeTextContent(tempGraphObj2TC);
}
OUString sSaveUrl = getPath(savename);
Reference<XStorable> xstorable(xComponent, UNO_QUERY);
Sequence<PropertyValue> saveProps(2);
saveProps[0].Name=OUString::createFromAscii("Overwrite");
saveProps[0].Value <<= sal_True;
saveProps[1].Name=OUString::createFromAscii("FilterName");
saveProps[1].Value <<= OUString::createFromAscii(saveformat);
xstorable->storeToURL(
sSaveUrl,
saveProps);
xComponent->dispose();
}
|
I hope someone gets something from this. Much thanks to pitonyak and Cybb20 without which I would have definitely given up on this before completing it. |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Fri Jul 16, 2004 1:01 pm Post subject: |
|
|
lizinerator you're more than welcome.
I am pretty sure that others will be happy to see your code, because C++ examples are very rare on this forum and compared to Java examples for OOo very rare on other sites, too.
Glad that you got it working.
I hope that you still use the forum sometimes and if you've something interesting in C++ just feel free to add it to the code section.
Thanks
Christian _________________ - Knowledge is Power - |
|
| 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
|