On Wed, 09 May 2007 17:26:49 -0500, Ariel Constenla-Haile <[EMAIL PROTECTED]> wrote:

Hola que tal, tengo este script quizas te sirva, el script basicamente genera duplicados de hojas haciendo un copy-paste e insertando adicionalmente una informacion desde un array.

Aqui esta el script:

REM  *****  BASIC  *****
REM
REM Script to insert sequencially the list of servers
REM to execute you need to select the starting page +1
REM and then select the ending page on the 'for Loop'
REM

'Load all the variables including the array
Sub LabelSheet
Dim oCell as Variant
Dim firstDoc as Variant
Dim oSheet as Variant
Dim title() as Variant
Dim titulo()
Dim x
REM title array takes the list from a CSV dump
title=Array("otherhost1",_
"otherhost2",_
"otherhost3",_
"otherhost4",_
"otherhost5",_
"otherhost6")


REM x works as a range, it start from the begining of the ARRAY
REM y is used to put the final starting page adding the value of
REM the "first page"

  firstDoc = ThisComponent
  for x = 0 to 6
  y= x
  oSheet= firstDoc.getSheets().getByIndex(y)

REM GetCellbyPosition will indicate the cell of the title
REM SetString will insert the text into the cell

  oCell=oSheet.GetCellbyPosition( 1,2 )
  firstDoc.CurrentController.Select(oCell)
  oCell.SetString(title(x))

REM for additional modification include the following:
REM    Position of the cell -> GetCellPosition
REM    Content of the cell  -> SetString

  oCell2=oSheet.GetCellbyPosition( 0,1 )
  firstDoc.CurrentController.Select(oCell2)
  oCell2.SetString("Server")

  Next x
End Sub


si tienes alguna pregunta lo podemos comentar en la lista. Basicamente algunas notas es que tengas en cuenta que uso nombres de hojas propias asi que en vez de decir Hoja 1 o Sheet 1.

Puedes ver tambien este otro blogpost:
http://my.opera.com/Jzarecta/blog/automating-work-with-basic

Ahi explico un poco el proceso donde 'loopeo' la accion de generar una hoja, insertarle el contenido.
--
Alexandro Colorado
OpenOffice.org
Community Contact // Mexico
http://www.openoffice.org

Twitter: http://www.twitter.com/jza
Jabber: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Responder a