https://bugs.freedesktop.org/show_bug.cgi?id=61329

--- Comment #22 from poky <[email protected]> ---
This opensource extension can help:
http://extensions.services.openoffice.org/en/project/pasteasvalue

This extension (macro)writed Mr. J. Pastierik and sent me it under GNU General
Public License.
Internet page: http://www.inet.sk/clanok/5845/makra-v-openoffice-org-02-2008:

global cells_from_calc_to_writer(0,0)
global column_from_calc_to_writer, lines_from_calc_to_writer as long

sub Copy_table_from_Calc_to_Writer
 dim dokument, cell as object
 dim column, line as long
 dim message as string

 if ThisComponent.supportsService("com.sun.star.sheet.SpreadsheetDocument")
then
  Dokument=ThisComponent.getCurrentSelection()
  column_from_calc_to_writer=dokument.getcolumns().Count
  lines_from_calc_to_writer=dokument.getrows().Count

  if column_from_calc_to_writer<>0 and lines_from_calc_to_writer<>0 then
   redim preserve cells_from_calc_to_writer(lines_from_calc_to_writer,
column_from_calc_to_writer)

   for column=0 to column_from_calc_to_writer-1
    for line=0 to lines_from_calc_to_writer-1
     cell=dokument.getCellByPosition(column, line)
     cells_from_calc_to_writer(line+1, column+1)=cell.getstring()
    next line
   next column
  endif
  message="Copied"+str(column_from_calc_to_writer)+" column and
"+str(lines_from_calc_to_writer)+" lines"
  msgbox message
 endif
end sub

sub Create_table_from_Calc_to_Writer
 dim dokument, cursor, table, cell as object
 dim column, line, shift_column, shift_line as long
 dim adress as string

 if ThisComponent.supportsService("com.sun.star.text.TextDocument") and _
  column_from_calc_to_writer<>0 and lines_from_calc_to_writer<>0 then
  dokument=StarDesktop.CurrentComponent
  cursor=ThisComponent.currentcontroller.getViewCursor()

  on error goto We_are_not_in_the_table

  table=cursor.TextTable

  adress=cursor.Cell.CellName
  shift_column=asc(left(adress, 1))-65
  shift_line=val(right(adress, len(adress)-1))-1

  wehave_table:
  on error resume next

  for line=1 to lines_from_calc_to_writer
   for column=1 to column_from_calc_to_writer
    adress=chr(64+column+shift_column)&(line+shift_line)
    cell=table.getCellByName(adress)
    cell.String= cells_from_calc_to_writer(line, column)
   next column
  next line
 else
  msgbox "In the mailbox is not table"
 endif

 exit sub

 We_are_not_in_the_table:
  table=dokument.createInstance("com.sun.star.text.TextTable")
  table.initialize(lines_from_calc_to_writer, column_from_calc_to_writer)
  dokument.Text.insertTextContent(cursor, table, false)
  goto wehave_table
end sub

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to