7 window = oDoc.getCurrentController().getFrame().getContainerWindow()
11 return ctx.getServiceManager().createInstanceWithContext(name, ctx)
13 toolkit = create(
"com.sun.star.awt.Toolkit")
14 msgbox = toolkit.createMessageBox(window, 0, 1,
"Message",
'foo')
15 link = create(
"com.sun.star.awt.UnoControlFixedHyperlink")
16 link_model = create(
"com.sun.star.awt.UnoControlFixedHyperlinkModel")
17 link.setModel(link_model)
18 link.createPeer(toolkit, msgbox)
19 link.setPosSize(35, 8, 100, 15, 15)
20 link.setText(
"Canale Telegram")
21 link.setURL(
"https://t.me/leeno_computometrico")
37 except Exception
as e:
41 DLG.MsgBox(
"Eccezione " + str(type(e)) +
"\nMessaggio: " + str(e.args) +
'\n' + traceback.format_exc())
94 somestring = somestring + i +
"\n"
112 import LeenoImport
as LI
126 oSheet = oDoc.CurrentController.ActiveSheet
128 for el
in reversed(range (1, lr)):
129 if oSheet.getCellByPosition(2, el).CellStyle ==
'comp 1-a' and \
130 "'" in oSheet.getCellByPosition(2, el).Formula:
131 ff = oSheet.getCellByPosition(2, el).Formula.split(
"'")
132 oSheet.getCellByPosition(2, el).Formula = ff[0] + ff[-1][1:]
139 oSheet = oDoc.CurrentController.ActiveSheet
142 oSheet.getCellRangeByPosition(0, 0, 1023, 1048575).Rows.OptimalHeight =
False
143 oSheet.getCellRangeByPosition(0, 0, 1023, 1048575).Rows.Height = 1576
144 DLG.mri(oSheet.getCellRangeByPosition(0, 0, usedArea.EndColumn, usedArea.EndRow).Rows)
147 for el
in reversed(range (1, lr)):
148 if oSheet.getCellByPosition(2, el).CellStyle ==
'comp 1-a' and \
149 oSheet.getCellByPosition(2, el).String ==
'' and \
150 oSheet.getCellByPosition(9, el).String ==
'':
151 oSheet.getRows().removeByIndex(el, 1)
152 elif oSheet.getCellByPosition(2, el).Type.value ==
'TEXT':
153 oSheet.getCellByPosition(2, el).String =
'- ' + oSheet.getCellByPosition(2, el).String
159 oSheet = oDoc.CurrentController.ActiveSheet
160 oSheets = oDoc.Sheets.ElementNames
164 dest =
'.'.join(os.path.basename(orig).split(
'.')[0:-1]) +
'.pdf'
165 orig = uno.fileUrlToSystemPath(orig)
166 dir_bak = os.path.dirname(oDoc.getURL())
168 oDoc.storeToURL(dir_bak +
'/' + dest, list())
195 filterData0 = PropertyValue()
196 filterData0.Name =
"Selection"
197 filterData0.Value = oDoc.CurrentController.ActiveSheet
198 filterData1 = PropertyValue()
199 filterData1.Name =
"IsAddStream"
200 filterData1.Value =
True
201 filterData.append(filterData0)
202 filterData.append(filterData1)
206 filterProps0 = PropertyValue()
207 filterProps0.Name =
"FilterName"
208 filterProps0.Value =
"calc_pdf_Export"
209 filterProps1 = PropertyValue()
210 filterProps1.Name =
"FilterData"
211 filterProps1.Value = tuple(filterData)
212 filterProps.append(filterProps0)
213 filterProps.append(filterProps1)
215 properties = tuple(filterProps)
217 sUrl =
"file:///W:/test.pdf"
218 oDoc.storeToURL(sUrl, properties)
224 oSheet = oDoc.CurrentController.ActiveSheet
225 DLG.chi(len(oSheet.RowPageBreaks))
253 es = dlg.getData(_EXPORTSETTINGSITEMS)
258 destFolder =
'W:\\_dwg\\ULTIMUSFREE\\_SRC'
265 if dlg[
'cbElencoPrezzi'].getState():
269 if dlg[
'cbComputoMetrico'].getState():
275 oSheets = list(oDoc.getSheets().getElementNames())
288 oSheet = oDoc.CurrentController.ActiveSheet
325 from com.sun.star.sheet.GeneralFunction
import MAX
331 testo, t=
'Inserisci il suffisso per il Codice Articolo (es: "BAS22/1_").')
332 if suffisso
in (
None,
'',
' '):
335 oSheet = oDoc.CurrentController.ActiveSheet
339 progress =
Dialogs.Progress(Title=
'Operazione in corso...', Text=
"Progressione")
341 progress.setLimits(n, lrow)
344 for y
in range(0, lrow):
345 if oSheet.getCellByPosition(0, y).CellStyle ==
"EP-aS" and \
346 oSheet.getCellByPosition(0, y).String !=
"000":
347 oSheet.getCellByPosition(0, y).String = suffisso + oSheet.getCellByPosition(0, y).String
353 oStyleFam = oDoc.StyleFamilies
354 oTablePageStyles = oStyleFam.getByName(
"PageStyles")
355 oCpyStyle = oDoc.createInstance(
"com.sun.star.style.PageStyle")
357 stili = (
"VARIANTE",
"COMPUTO",
"COMPUTO_print",
'Elenco Prezzi',
'CONTABILITA',
'Registro',
'SAL')
360 oTablePageStyles.insertByName(el, oCpyStyle)
365 DLG.mri(oDoc.StyleFamilies.getByName(
'PageStyles')[1])
367 stili = oDoc.StyleFamilies.getByName(
'PageStyles').getElementNames()
368 oDoc.getStyleFamilies().loadStylesFromURL(filename, list())
375 oColumn = oSheet.getColumns().getByIndex(23)
376 DLG.chi(int(oColumn.computeFunction(MAX)))
382 DLG.chi(oSheet.getCellRangeByName(
"A1").CellBackColor)
389 oRange = oDoc.NamedRanges.elenco_prezzi.ReferredCells.RangeAddress
390 SR = oRange.StartRow + 1
392 oSheet = oDoc.CurrentController.ActiveSheet
394 oDoc.CurrentController.select(oSheet.getCellRangeByPosition(1, SR, 1, ER -1))
397 oSheet = oDoc.CurrentController.ActiveSheet
400 for y
in reversed(range(1, lrow)):
401 if oSheet.getCellByPosition(1, y).String ==
"CAM":
402 oSheet.getCellByPosition(2, y).String =
"CAM - " + oSheet.getCellByPosition(2, y).String
416 oSheet = oDoc.CurrentController.ActiveSheet