How to use the Spread 12 FormatCells dialog

Posted by: Peter.Priestley on 6 March 2019, 5:38 pm EST

    • Post Options:
    • Link

    Posted 6 March 2019, 5:38 pm EST

    Can you provide some sample code for invoking the new Spread 12 FormatCells dialog in a c# windows forms application?

    The stumbling block seems to be that I have to provide an IWorkSheet and/or an IRange object to the FormatCells constructor, and I’m not sure how to extract these from my FpSpread control.

  • Posted 7 March 2019, 12:43 pm EST

    OK, after much investigation, I gather there is a “new api” which is described by the IWorkbook, IWorksheet, etc… interfaces.

    You can cast a fpSpread to an IWorkbook using fpSpread.AsWorkbook().

    Hence I am able to invoke the FormatCells dialog as follows.

                IWorkbook wb = fpSpread1.AsWorkbook();
                var cellrange = fpSpread1.ActiveSheet.GetSelection(0);
                if (cellrange != null)
                {
                    var cellref = new Reference(cellrange.Row,
                        cellrange.Column,
                        cellrange.Row + cellrange.RowCount - 1,
                        cellrange.Column + cellrange.ColumnCount - 1);
    
                    FormatCells fcd = new FormatCells(wb.ActiveSheet, cellref, FormatCells.FormatCellsTab.Number);
                    fcd.ShowDialog();
                }
    
    

    Are there any general tutorials on using the “new api”?

  • Posted 7 March 2019, 5:45 pm EST

    Hello,

    You can find list of all members Spread NameSpace here:

    https://help.grapecity.com/spread/SpreadNet12/WF/webframe.html#GrapeCity.Spreadsheet~GrapeCity.Spreadsheet_namespace.html

    The respective links for the interfaces/classes will direct you to the information about that particular topic.

    In case you are looking something specific, please let me know.

    Thanks,

    Deepak Sharma

  • Posted 18 March 2019, 11:15 pm EST

    I have a question regarding the use of the FormatCells Dialog.

    Is there a way to disable a specific tab or remove a specific tab from the dialog upon displaying of the dialog?

    For example we do not want the users changing the cell type through the dialog but do want them to be able to change color font protection and all that type of stuff.

    Thanks for any guidance,

    Kevin

    Kevin

  • Posted 19 March 2019, 9:01 pm EST

    Hello Kevin,

    Unfortunately, we couldn’t find a way to customize FormatCells dialog in order to hide tab for changing CellType.

    We regret the inconvenience.

    Thanks,

    Reeva

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels