ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2014-06-05 21:21:26

hgaspar
Member
Registered: 2014-06-05
Posts: 8

Grid.PrintableRange

i'm using ReoGrid-0.8.6.0-Alpha-Build


Error using PrintableRange

'PrintableRange' is ambiguous because multiple kinds of members with this name exist in class 'unvell.ReoGrid.ReoGridControl'.

Last edited by hgaspar (2014-06-05 21:24:53)

Offline

#2 2014-06-06 14:50:53

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Grid.PrintableRange

I guess you are using VB.NET.

It is a bug, before it get fixed please use following code instead:

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

	'Add control on form
	Dim grid As New unvell.ReoGrid.ReoGridControl
	grid.Dock = DockStyle.Fill
	Me.Controls.Add(grid)

	'Set cell value
	grid(10, 10) = "A"

	'Set printable range  (instead of PrintableRange = New ReoGridRange(...))
	Dim pi As System.Reflection.PropertyInfo = grid.GetType().GetProperty("PrintableRange")
	pi.SetValue(grid, New unvell.ReoGrid.ReoGridRange(1, 1, 10, 10))

	'Perform page split
	grid.AutoSplitPage()

	'Show print break lines
	grid.EnableSettings(unvell.ReoGrid.ReoGridSettings.View_ShowPageBreaks)

End Sub

Offline

#3 2014-06-07 17:17:15

hgaspar
Member
Registered: 2014-06-05
Posts: 8

Re: Grid.PrintableRange

Yes i use VB.

Thanks for the suggestion. it works but i get an error performing AutoSplitPage:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

Additional information: Index was out of range. Must be non-negative and less than the size of the collection.


My code:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      Dim range As ReoGridRange = New ReoGridRange(0, 0, Grd.RowCount, Grd.ColCount)
      Grd.SetRangeStyle(range, New ReoGridStyleObject With {.Flag = PlainStyleFlag.FontName, .FontName = "Calibri"})

      'Grd.PrintableRange = range
      Dim pi As System.Reflection.PropertyInfo = Grd.GetType().GetProperty("PrintableRange")
      pi.SetValue(Grd, range)

      'Perform page split
      Grd.AutoSplitPage()

      'Show print break lines
      Grd.EnableSettings(ReoGridSettings.View_ShowPageBreaks)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

The range works fine for SetRangeStyle, but raises an error on AutoSplitPage

Adding one row and one column to the grid and use Grd.RowCount - 1 and Grd.ColCount - 1  solved my problem!

Dim range As ReoGridRange = New ReoGridRange(0, 0, Grd.RowCount - 1, Grd.ColCount - 1)

Offline

#4 2014-06-08 02:12:46

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Grid.PrintableRange

Thanks for pointing out and the solution. It seems missing boundary check, it should be fixed in next release.

Offline

#5 2014-06-17 14:44:59

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Grid.PrintableRange

This issue has been fixed and the new version now available for downloading: (v0.8.6.1)
http://reogrid.net/download/

Offline

Board footer

Powered by FluxBB