Search code examples
winformsvisual-studio-2015spreadsheetgear

Spreadsheet Gear migration errors


I am migrating Spreadsheet gear of my application from 6.0.3.190 to 7.4.1.104.I am getting my issues with Color property.Can any one help me in this.Now I am using using Color = System.Drawing.Color; and also ToSGColor().This became very hectic to do in all places where ever we use color.I expect we should have some shortcut to do this.Can any one suggest me How can i get all functionalities with few changes only.I am also getting exceptions to c onvert IColorFormat.LineColor to system.drawing.Color.


Solution

  • Note the "Breaking Changes" page in the SpreadsheetGear 2012 documentation, which lists this particular change:

    • In order to support WPF and Silverlight, the core API has been separated from the GDI+ and Windows Forms APIs and therefore uses the new SpreadsheetGear.Color type rather than SpreadsheetGear.Drawing.Color. SpreadsheetGear.Drawing.Color has been moved to SpreadsheetGear2012.Drawing.dll. See SpreadsheetGear.Drawing.Color for an example which uses the implicit and static converters to convert between SpreadsheetGear.Color, SpreadsheetGear.Drawing.Color and System.Drawing.Color. SpreadsheetGear.Colors and SpreadsheetGear.SystemColors provide helpful predefined colors to replace the use of predefined colors in System.Drawing.Color.

    So you'll need to ensure than any place where you were previously using System.Drawing colors now use SpreadsheetGear.Drawing colors, including API like IColorFormat.LineColor.

    There aren't really any "migration" tools to automatically convert such instances to the new API. So you'll need to resolve these errors for each code file. Doing a Find/Replace keyword search for "System.Drawing" and "SpreadsheetGear.Drawing" could possibly speed up the process, though this would depend on what using statements you have added to each code file.