Application of Spread in C #

xiaoxiao2021-03-06  111

Spread belongs to a table component of the COM class, I believe that everyone is widely used in the VB database program. Now simply summarize the application of this component in C #.

The first is to add Spread to the project, which is a common .NET to COM reference, which is no longer detailed, just explaining: This control is located in the bin directory of Spread, name is SPR32X60.OCX, don't reference it.

Then, the control is then referenced. We can use this control.

The most basic operation is of course realizing the reading and writing of cells, and then some complex format settings. Before reading or setting a cell value, you must specify the row and column corresponding to the cell, then call .Text = value settings, or Return .Text typical examples, assume the table name SPD, now read cells (2, 3) SPD.ROW = 2; spd.col = 3; returnistext;

Set the value of cells (2, 3) "Hello" spd.row = 2; spd.col = 3; spd.text = "hello";

Then there are some simple format settings, such as I want to set a cell's control type to buttons spd.row = 2; SPD.col = 3; // Is it found that these two statements are common? SPD.CellType = fpspread.celltypeConstants.cellTypeStaticText; If you set color, like front, first specify rows and columns and use spd.backcolor = color; foreground color: SPD.ForeColor = Color; Note: Here: Color is System.drawing. COLOR data type value

Other no more details, what the property needs to be set can be seen from the object model to the corresponding properties, and the setting method is basically the same.

转载请注明原文地址:https://www.9cbs.com/read-125413.html

New Post(0)