Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NET code hangs setting up a chart
I have some .NET code that opens an excel spreadsheet, dumps some data into
it, and then makes a chart. The problem is that once the data becomes so big, the system seems to hang. The routine invovled looks like this: Private Sub CreateExcelChart(ByVal xl As Excel.Application, ByVal wb As Excel.Workbook, ByVal xlRow As Integer, ByVal xlFirstCol As Integer, ByVal xlLastCol As Integer) Dim sheetData As Excel.Worksheet = wb.Sheets("ChartData") Select Case Me.ExcelGraphType Case OLAPGridExcelGraphType.BarGraph 'This code branch is not the issue Case OLAPGridExcelGraphType.LineGraph 'This one is sheetData.Range(sheetData.Cells(2, 1), sheetData.Cells(xlRow - 2, xlLastCol)).Select() wb.Charts.Add() wb.ActiveChart.ChartType = Excel.XlChartType.xlLineMarkers wb.ActiveChart.PlotBy = Excel.XlRowCol.xlRows <<<<<<< THIS IS WHERE I HANG Dim s As Excel.Series For Each s In wb.ActiveChart.SeriesCollection s.XValues = "=ChartData!R1C" & xlFirstCol & ":R2C" & xlLastCol Next End Select wb.ActiveChart.Move(After:=wb.Sheets(2)) End Sub Has anyone seen this? Thanks, Chris Magoun |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NET code hangs setting up a chart
I see the problem now. The plotBy = Rows can only take up to 255 rows or
else it chokes and throws a dialog, which is hanging the system. Chris "Chris Magoun" wrote in message ... I have some .NET code that opens an excel spreadsheet, dumps some data into it, and then makes a chart. The problem is that once the data becomes so big, the system seems to hang. The routine invovled looks like this: Private Sub CreateExcelChart(ByVal xl As Excel.Application, ByVal wb As Excel.Workbook, ByVal xlRow As Integer, ByVal xlFirstCol As Integer, ByVal xlLastCol As Integer) Dim sheetData As Excel.Worksheet = wb.Sheets("ChartData") Select Case Me.ExcelGraphType Case OLAPGridExcelGraphType.BarGraph 'This code branch is not the issue Case OLAPGridExcelGraphType.LineGraph 'This one is sheetData.Range(sheetData.Cells(2, 1), sheetData.Cells(xlRow - 2, xlLastCol)).Select() wb.Charts.Add() wb.ActiveChart.ChartType = Excel.XlChartType.xlLineMarkers wb.ActiveChart.PlotBy = Excel.XlRowCol.xlRows <<<<<<< THIS IS WHERE I HANG Dim s As Excel.Series For Each s In wb.ActiveChart.SeriesCollection s.XValues = "=ChartData!R1C" & xlFirstCol & ":R2C" & xlLastCol Next End Select wb.ActiveChart.Move(After:=wb.Sheets(2)) End Sub Has anyone seen this? Thanks, Chris Magoun |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 hangs while loading chart | Charts and Charting in Excel | |||
Setting Chart MajorUnit for Clean lookng Chart | Excel Programming | |||
Code hangs Excel ... Why? ... and how can i debug?? | Excel Programming | |||
vc++ automation: opening chart as chart window and setting scale | Excel Programming | |||
Chart.Export creates zero byte GIF and hangs on server | Excel Programming |