PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV Mobile 2024
→
Re: Automartion OpenOffice
Re: Automartion OpenOffice
Started by Yves UN, Sep., 24 2010 5:09 PM - No answer
Connect yourself…
Yves UN
#1
Posted on September, 24 2010 - 5:09 PM
Bon j'avance c'est cool.
Voilà mon bout de code
Clic sur le bouton Save
// Variables locales
MNoArgs est un
tableau de
0
Variant
s
NomDocument1
,
s
NomDocument2
,
CheminComplet sont des
chaînes
// Y-a-t-il un document actif
SI
EstOuvert
(
)
=
Faux
ALORS
Erreur
(
"Aucun document OpenOffice Writer n'est ouvert."
,
"L'enregistrement est impossible."
)
s
NomDocument1
=
""
SINON
SI
CheminComplet
<
>
""
ALORS
s
NomDocument1
=
CheminComplet
SINON
s
NomDocument1
=
fSélecteur
(
SAI_
ChMailCréé
,
""
,
"Enregistrer sous..."
,
"Document HTML (*.html)"
+
TAB
+
"*.HTML"
,
"*.html"
,
fselCrée
)
FIN
SI
s
NomDocument1
<
>
""
ALORS
// Formatage du chemin du fichier
s
NomDocument2
=
"file:///"
+
Remplace
(
s
NomDocument1
,
"\"
,
"/"
)
// Enregistrement du document
oODocument
>
>
storeToURL
(
s
NomDocument2
,
MNoArgs
)
FIN
FIN
Procédure EstOuvert()
Procedure VIRTUELLE
EstOuvert
(
)
QUAND EXCEPTION DANS
//Tentative d'accès à la feuille active du document
oODocument
>
>
CurrentController
>
>
ViewCursor
(
)
RENVOYER
Vrai
FAIRE
ExceptionActive
(
)
Libérer
oODocument
RENVOYER
Faux
FIN
C'est une solution qui fonctionne pour enregistrer des document au format .Odt ou txt. si on veut enregistrer dans un autre format, HTML par exemple, il faut utiliser des filtres et c'est là que je bloque...
source ici :
http://www.oooforum.org/forum/viewtopic.phtml…
Quand j'essaie de donner des valeurs au tableau de variant "MnoArgs" ça plante...
MNoArgs
[
1
] =
MakePropertyValue
(
"FilterName"
,
"HTML (StarWriter)"
)
Procedure
MakePropertyValue
(
PropName est une
chaîne
,
PropValue est un Variant
)
tab
RESULT est un
objet OLE
dynamique
tab
RESULT
=
oOServiceManager
>
>
Bridge_GetStruct
(
"com.sun.star.beans.PropertyValue"
)
tab
RESULT
>
>
Name
=
PropName
tab
RESULT
>
>
Value
=
PropValue
RENVOYER
tab
RESULT
l'erreur que j'obtiens c'est :
Erreur à la ligne 50 du traitement Clic sur BTN_Save.
La dimension 1 du tableau possède 0 élément(s) et vous tentez d'accéder à l'élément 1.
Report
0
0
→ Go back to WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
WEBDEV (earlier versions)
WINDEV Mobile (earlier versions)
Reports & Queries
Off-topic
Tools
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text