Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Ciao Ricarco,
ho preso spunto dalle tue indicazioni e da altra documentazione che ho trovato per fare una macro.
Ci si mette nella prima cella della tabella ed esegue i due passaggi.

-----------------
sub Converti_Formato_Esponenziale
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem -- Seleziono tutta la tabella
dispatcher.executeDispatch(document, ".uno:EndOfDocumentSel", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:EndOfDocumentSel", "", 0, Array())

rem -- Effettuo la prima sostituzione
dim args1(21) as new com.sun.star.beans.PropertyValue
args1(0).Name = "SearchItem.StyleFamily"
args1(0).Value = 2
args1(1).Name = "SearchItem.CellType"
args1(1).Value = 0
args1(2).Name = "SearchItem.RowDirection"
args1(2).Value = true
args1(3).Name = "SearchItem.AllTables"
args1(3).Value = false
args1(4).Name = "SearchItem.Backward"
args1(4).Value = false
args1(5).Name = "SearchItem.Pattern"
args1(5).Value = false
args1(6).Name = "SearchItem.Content"
args1(6).Value = false
args1(7).Name = "SearchItem.AsianOptions"
args1(7).Value = false
args1(8).Name = "SearchItem.AlgorithmType"
args1(8).Value = 1
args1(9).Name = "SearchItem.SearchFlags"
args1(9).Value = 71680
args1(10).Name = "SearchItem.SearchString"
args1(10).Value = "E([-+]?[:digit:]+)"
args1(11).Name = "SearchItem.ReplaceString"
args1(11).Value = "·10E$1"
args1(12).Name = "SearchItem.Locale"
args1(12).Value = 255
args1(13).Name = "SearchItem.ChangedChars"
args1(13).Value = 2
args1(14).Name = "SearchItem.DeletedChars"
args1(14).Value = 2
args1(15).Name = "SearchItem.InsertedChars"
args1(15).Value = 2
args1(16).Name = "SearchItem.TransliterateFlags"
args1(16).Value = 1280
args1(17).Name = "SearchItem.Command"
args1(17).Value = 3
args1(18).Name = "Quiet"
args1(18).Value = true
args1(19).Name = "Escapement.Escapement"
args1(19).Value = 0
args1(20).Name = "Escapement.Height"
args1(20).Value = 100
args1(21).Name = "Escapement.Auto"
args1(21).Value = false

dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())

rem -- Riseleziono tutta la tabella
dispatcher.executeDispatch(document, ".uno:GoToStartOfDoc", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:GoToStartOfDoc", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:EndOfDocumentSel", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:EndOfDocumentSel", "", 0, Array())

rem -- Tolgo eventuali apico
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Escapement.Escapement"
args2(0).Value = 0
args2(1).Name = "Escapement.Height"
args2(1).Value = 100
args2(2).Name = "Escapement.Auto"
args2(2).Value = false

dispatcher.executeDispatch(document, ".uno:Escapement", "", 0, args2())

rem -- Metto in apice solo l'esponente del 10
args1(11).Name = "SearchItem.ReplaceString"
args1(11).Value = "$1"
args1(19).Name = "Escapement.Escapement"
args1(19).Value = 101
args1(20).Name = "Escapement.Height"
args1(20).Value = 58
args1(21).Name = "Escapement.Auto"
args1(21).Value = true
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())

end sub
----------------------

Sono sicuramente ridondanti i passaggi per la selezione di tutta la tabella così come quelli di 
eliminare la formattazione "apice" per poi rimetterla ma non sono riuscito a trovare un'alternativa.
Grazie ancora

Alberto

----- Messaggio originale -----
Da: "Ricardo" <rgb.mldc@openmailbox.org>
A: users@it.libreoffice.org
Inviato: Venerdì, 18 novembre 2016 21:04:06
Oggetto: Re: [it-users] Writer trova e sostituisci con formattazione carattere

El 2016-11-18 14:45, Alberto Benedetto escribió:
Buongiorno a tutti,
avrei bisogno di modificare una serie di numeri in una tabella writer,
compilata da dati provenienti da un foglio calc.
Le quantità sono rappresentate con l'esponente in formato
"computerese" ;) del tipo 1,5E-3 mentre io devo utilizzare la
notazione "umana" 1,5 (puntino) 10 (alla)-3, con il -3 in apice al 10.
Ci si potrebbe arrangiare con il "trova e sostituisci" ma non riesco
ad esprimere la formattazione dell'esponente in apice.
Qualcuno ho qualche consiglio da darmi?
Grazie

Alberto

Lo puoi fare in due passaggi con espressioni regolari.

Ctrl-H per aprire il «trova e sostituisci» → Altre opzioni → la spunta 
su Espressioni regolari

In trova scrivi

E(-?[:digit:]+)

in sostituisci

.10E$1

Questo cambierà numeri del tipo 3,5E-5 per 3,5.10E-5 e 5,5E22 per 
5,5.10E22 eccetera.

Finito il primi giro di sostituzioni, lascia il «trova» invariato, in 
sostituisci lascia soltanto

$1

Con il cursore ancora in sostituisci, clicca sul bottone Formato → 
scheda Posizione → Apice.

Ecco fatto.

A presto,
Ricardo


-- 
Il mio blog in italiano: https://ilpinguinoscrittore.wordpress.com/
Mi blog en español: https://elpinguinotolkiano.wordpress.com/

-- 
Come cancellarsi: E-mail users+unsubscribe@it.libreoffice.org
Problemi? http://it.libreoffice.org/supporto/mailing-lists/come-cancellarsi/
Linee guida per postare + altro: http://wiki.documentfoundation.org/Local_Mailing_Lists/it
Archivio della lista: http://listarchives.libreoffice.org/it/users/
Tutti i messaggi inviati a questa lista vengono archiviati pubblicamente e non sono eliminabili

--
Questo messaggio e' stato analizzato ed e' risultato non infetto.
This message was scanned and is believed to be clean.


-- 
Come cancellarsi: E-mail users+unsubscribe@it.libreoffice.org
Problemi? http://it.libreoffice.org/supporto/mailing-lists/come-cancellarsi/
Linee guida per postare + altro: http://wiki.documentfoundation.org/Local_Mailing_Lists/it
Archivio della lista: http://listarchives.libreoffice.org/it/users/
Tutti i messaggi inviati a questa lista vengono archiviati pubblicamente e non sono eliminabili

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.