| View previous topic :: View next topic |
| Author |
Message |
wedders Newbie

Joined: 04 Feb 2011 Posts: 2
|
Posted: Fri Feb 04, 2011 9:29 am Post subject: Extract or Export Chart Data Table contents |
|
|
| I am able to view the values used in the 'Chart Data Table' window, is there a way to export or extract these values back into a spreadsheet? |
|
| Back to top |
|
 |
wedders Newbie

Joined: 04 Feb 2011 Posts: 2
|
Posted: Mon Feb 07, 2011 4:05 am Post subject: |
|
|
Any thoughts on this? Is the forum conclusion that it is not possible to extract data from the Chart Data Table?
Thanks. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Mon Feb 07, 2011 9:08 am Post subject: |
|
|
I have no clear imagination what you are talking about. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
ftack Moderator


Joined: 27 Jan 2003 Posts: 3102 Location: Belgium
|
Posted: Mon Feb 07, 2011 9:13 am Post subject: |
|
|
If you can see the data of your chart in the 'Chart Data Table' window, you can copy/paste them in a spreadsheet. _________________ --
GNU/Linux (Ubuntu) |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Mon Feb 07, 2011 9:26 am Post subject: |
|
|
| Quote: | You mean a chart in a document type other than spreadsheet?
I can copy a whole chart from Writer into Calc, including the embedded table, but I can't copy all the data in one go, only one-by-one. |
Oops, indeed! You cannot select all data and copy them elsewhere. What a ridiculous limitation. Actually, the last time I used such stand alone charts was in Word 95, and there you could copy and move the data like in a spreadsheet. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Mon Feb 07, 2011 11:16 am Post subject: |
|
|
| Code: | REM ***** BASIC *****
REM Pull data from data table into sheet range
REM Copy the whole chart from Writer to Calc.
REM USAGE: Click the target cell and then select the chart (one click) and run this:
Sub ChartDataToActiveCell()
REM load helper functions getActiveCell and getOffsetRange
GlobalScope.BasicLibraries.loadLibrary("Calc")
oView = ThisComponent.getCurrentController()
oCell = Calc.scalc.getActiveCell(oView)
REM get the chart and its dimensions
obj = ThisComponent.CurrentSelection.getByIndex(0)
a() = obj.Model.Data.getData()
r() = a(0)
nr = uBound(a()) +1
nc = uBound(r()) +1
REM resize the active cell selection and dump data
rg = Calc.scalc.getOffsetRange(oCell,0,0,nr,nc)
rg.setDataArray(a())
End Sub |
Required helper functions from my module Calc.scalc:
| Code: |
Function getOffsetRange(oRg, nRowOffset&, nColOffset&, nRowResize&, nColResize&)
Dim addr
'calls: getRangeByAddress
addr = oRg.getRangeAddress()
addr.StartRow = addr.StartRow + nRowOffset
addr.EndRow = addr.EndRow + nRowOffset
addr.StartColumn = addr.StartColumn + nColOffset
addr.EndColumn = addr.EndColumn + nColOffset
if nRowResize > 0 then addr.EndRow = addr.StartRow + nRowResize -1
if nColResize > 0 then addr.EndColumn = addr.StartColumn + nColResize -1
getOffsetRange = getRangeByAddress(oRg.getSpreadsheet(), addr)
End Function
'pass a spreadsheet-document, sheet or range together with a c.s.s.table.CellRangeAddress
'return empty if oAddr out of bounds or wrong obj
Function getRangeByAddress(obj, oAddr as com.sun.star.table.CellRangeAddress)
on error goto nullErr:
Dim oSheet
If obj.supportsService("com.sun.star.sheet.SpreadsheetDocument") then
REM use the sheet specified by given address
oSheet = obj.getSheets.getByIndex(oAddr.Sheet)
else
REM use given object (range/sheet) as parent range
oSheet = obj
endif
getRangeByAddress = oSheet.getCellRangeByPosition(oAddr.StartColumn,oAddr.StartRow,oAddr.EndColumn,oAddr.EndRow)
exit function
nullErr:
getRangeByAddress = Null
End Function
Function getActiveCell(oView)
Dim as1(), lSheet&,lCol&,lRow$, sDum as String,bErr as Boolean
as1() = Split(oView.ViewData, ";")
lSheet = CLng(as1(1))
sDum = as1(lSheet +3)
as1() = Split(sDum, "/")
on error goto errSlash
lCol = CLng(as1(0))
lRow = CLng(as1(1))
on error goto 0
getActiveCell = oView.Model.getSheets.getByIndex(lSheet).getcellByPosition(lCol,lRow)
exit Function
errSlash:
if NOT(bErr) then
bErr = True
as1() = Split(sDum, "+")
resume
endif
End Function
|
_________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|