9 Star 6 Fork 3

葡萄城/dataprocess

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Template_Edit.aspx.cs 26.19 KB
一键复制 编辑 原始数据 按行查看 历史
葡萄城控件 提交于 2014-12-22 13:54 . InitCode
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FarPoint.Web.Spread;
using FarPoint.Web.Spread.Model;
using FarPoint.CalcEngine;
using System.Data;
using System.Drawing;
using System.IO;
namespace ControlExplorer
{
public partial class Template_Edit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
#region 初始化模板
string tid = "";
tid = Request.QueryString["tid"];
hfTemplateID.Value = tid;
DataTable dt = new DataTable();
string commandstring = string.Format("SELECT * FROM 模板列表 WHERE 模板编号='{0}'", tid);
string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString;
using (System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection(connectionstring))
{
System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(commandstring, connection);
System.Data.OleDb.OleDbCommandBuilder builder = new System.Data.OleDb.OleDbCommandBuilder(adapter);
adapter.Fill(dt);
}
byte[] templatebytes = dt.Rows[0]["模板"] as byte[];
System.IO.MemoryStream ms = new System.IO.MemoryStream(templatebytes);
SheetSkin skin = fpTemplate.Sheets[0].ActiveSkin;
fpTemplate.Open(ms);
fpTemplate.EnableAjaxCall = true;
fpTemplate.EnableClientScript = true;
fpTemplate.Sheets[0].AllowPage = false;
fpTemplate.CommandBar.Visible = false;
fpTemplate.Sheets[0].ActiveSkin = skin;
fpTemplate.UseClipboard = false;
fpTemplate.Sheets[0].Protect = true;
fpTemplate.Sheets[0].LockBackColor = Color.LightGray;
#endregion
#region 填充模板数据
List<string> columns = DataTools.GetTemplateDataFields(hfTemplateID.Value);
// 所有存放数据的表结构中,第一列为ID、第二列为记录编号,所以i从2开始
for (int i = 1; i < columns.Count; i++)
{
ExternalCellExpression expr = fpTemplate.Sheets[0].GetCustomName(columns[i]) as ExternalCellExpression;
if (expr != null)
{
fpTemplate.Sheets[0].SetText(expr.Row, expr.Column, "[" + columns[i] + "]");
}
lstDataFields.Items.Add(columns[i]);
}
DataRow dr = DataTools.GetTemplate(hfTemplateID.Value);
if (dr["模板类型"].Equals("动态行模板"))
{
ExternalRangeExpression expr = fpTemplate.Sheets[0].GetCustomName("DataArea") as ExternalRangeExpression;
if (expr == null)
{
Response.Write("<script>alert('该模板还没有设置数据绑定区域,请通过\"设置数据区域\"按钮进行设置!');</script>");
}
}
#endregion
}
}
#region 菜单操作
// 保存模板
private void SaveTemplate()
{
fpTemplate.SaveChanges();
string tid = hfTemplateID.Value;
UpdataTemplate(tid);
}
// 保存上传的模板至数据库
private void UpdataTemplate(string tid)
{
fpTemplate.Sheets[0].LockBackColor = Color.Transparent;
List<string> columns = DataTools.GetTemplateDataFields(tid);
// 清除数据字段对应单元格的文本
for (int i = 0; i < columns.Count; i++)
{
ExternalCellExpression expr = fpTemplate.Sheets[0].GetCustomName(columns[i]) as ExternalCellExpression;
if (expr != null)
{
fpTemplate.Sheets[0].SetText(expr.Row, expr.Column, null);
}
}
// 插入模板
string commandstring = "SELECT * FROM 模板列表 WHERE 模板编号='" + tid + "'";
string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString;
using (System.Data.OleDb.OleDbConnection connection = new System.Data.OleDb.OleDbConnection(connectionstring))
{
System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(commandstring, connection);
System.Data.OleDb.OleDbCommandBuilder builder = new System.Data.OleDb.OleDbCommandBuilder(adapter);
DataTable dt = new DataTable();
adapter.Fill(dt);
DataRow dr = dt.Rows[0];
System.IO.MemoryStream ms = new System.IO.MemoryStream();
fpTemplate.Save(ms, false);
byte[] templatebytes = new byte[ms.Length];
templatebytes = ms.ToArray();
ms.Close();
dr["模板"] = templatebytes;
adapter.Update(dt);
}
fpTemplate.Sheets[0].LockBackColor = Color.LightGray;
// 恢复数据字段对应单元格的文本
for (int i = 0; i < columns.Count; i++)
{
ExternalCellExpression expr = fpTemplate.Sheets[0].GetCustomName(columns[i]) as ExternalCellExpression;
if (expr != null)
{
fpTemplate.Sheets[0].SetText(expr.Row, expr.Column, string.Format("[{0}]", columns[i]));
}
}
}
// 加粗
private void FontBold()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
StyleInfo oldstyle = iss.GetCompositeInfo(r, c, 0, null);
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.Font.Bold = !oldstyle.Font.Bold;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 斜体
private void FontItalic()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
StyleInfo oldstyle = iss.GetCompositeInfo(r, c, 0, null);
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.Font.Italic = !oldstyle.Font.Italic;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 下划线
private void FontUnderline()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
StyleInfo oldstyle = iss.GetCompositeInfo(r, c, 0, null);
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.Font.Underline = !oldstyle.Font.Underline;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 左对齐
private void AlignLeft()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.HorizontalAlign = HorizontalAlign.Left;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 居中对齐
private void AlignCenter()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.HorizontalAlign = HorizontalAlign.Center;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 右对齐
private void AlignRight()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.HorizontalAlign = HorizontalAlign.Right;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 合并单元格
private void MergeCell()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
StyleInfo oldstyle = iss.GetCompositeInfo(r, c, 0, null);
FarPoint.Web.Spread.Model.CellRange selection = fpTemplate.Sheets[0].SelectionModel[0];
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].GetSpanCell(r, c);
if ((cr.RowCount > 1 || cr.ColumnCount > 1))
{
fpTemplate.Sheets[0].RemoveSpanCell(r, c);
}
else
{
fpTemplate.Sheets[0].AddSpanCell(selection.Row, selection.Column, selection.RowCount, selection.ColumnCount);
}
}
// 插入行
private void InsertRow()
{
fpTemplate.Sheets[0].Rows.Add(fpTemplate.Sheets[0].ActiveRow + 1, 1);
}
// 删除行
private void DeleteRow()
{
fpTemplate.Sheets[0].Rows.Remove(fpTemplate.Sheets[0].ActiveRow, 1);
}
// 行高
private void RowHeight(int size)
{
fpTemplate.Sheets[0].Rows[fpTemplate.Sheets[0].ActiveRow].Height = size;
}
// 插入列
private void InsertColumn()
{
fpTemplate.Sheets[0].Columns.Add(fpTemplate.Sheets[0].ActiveColumn, 1);
}
// 删除列
private void DeleteColumn()
{
fpTemplate.Sheets[0].Columns.Remove(fpTemplate.Sheets[0].ActiveColumn, 1);
}
// 列宽
private void ColWidth(int size)
{
fpTemplate.Sheets[0].Columns[fpTemplate.Sheets[0].ActiveColumn].Width = size;
}
// 字体
private void FontName(string name)
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
StyleInfo oldstyle = iss.GetCompositeInfo(r, c, 0, null);
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.Font.Name = oldstyle.Font.Name;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 字号
private void FontSize(int size)
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
StyleInfo oldstyle = iss.GetCompositeInfo(r, c, 0, null);
int s1 = size;
switch (s1)
{
case 1:
oldstyle.Font.Size = FontUnit.Smaller;
break;
case 2:
oldstyle.Font.Size = FontUnit.Small;
break;
case 3:
oldstyle.Font.Size = FontUnit.Medium;
break;
case 4:
oldstyle.Font.Size = FontUnit.Larger;
break;
case 5:
oldstyle.Font.Size = FontUnit.Large;
break;
case 6:
oldstyle.Font.Size = FontUnit.XLarge;
break;
}
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.Font.Size = oldstyle.Font.Size;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 背景色
private void BackColor(Color backcolor)
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.BackColor = backcolor;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 前景色
private void ForeColor(Color forecolor)
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
StyleInfo newstyle = iss.GetCompositeInfo(i + cr.Row, j + cr.Column, 0, null);
newstyle.ForeColor = forecolor;
iss.SetDirectInfo(i + cr.Row, j + cr.Column, newstyle);
}
}
}
// 锁定单元格颜色
private void LockColor(string name)
{
if (name == "常规显示")
{
fpTemplate.Sheets[0].LockBackColor = Color.Transparent;
}
else
{
fpTemplate.Sheets[0].LockBackColor = Color.LightGray;
}
}
// 模板保护模式
private void SetProtect(string name)
{
if (name == "取消保护")
{
fpTemplate.Sheets[0].Protect = false;
}
else
{
fpTemplate.Sheets[0].Protect = true;
}
}
private void UpdateRow(string parameters)
{
}
// 设置单元格绑定数据字段
private void SetDataField(string name)
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
string newname = name;
string oldname = "";
List<string> columns = DataTools.GetTemplateDataFields(hfTemplateID.Value);
DefaultSheetDataModel dtModel = (fpTemplate.Sheets[0].DataModel as DefaultSheetDataModel);
var customnames = dtModel.GetCustomNameEnumerator();
foreach (string col in columns)
{
ExternalCellExpression expr = dtModel.GetCustomName(col) as ExternalCellExpression;
if (expr != null)
{
if (expr.Row == r && expr.Column == c)
{
oldname = col;
fpTemplate.Sheets[0].Cells[expr.Row, expr.Column].ResetText();
}
if (newname.Equals(col))
{
fpTemplate.Sheets[0].Cells[expr.Row, expr.Column].ResetText();
}
}
}
dtModel.RemoveCustomName(oldname);
dtModel.RemoveCustomName(newname);
dtModel.AddCustomName(newname, new ExternalCellExpression(dtModel, r, c));
fpTemplate.Sheets[0].SetText(r, c, "[" + newname + "]");
}
// 删除当前单元格绑定的数据字段
private void DeleteDataField()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
DefaultSheetDataModel dtModel = (fpTemplate.Sheets[0].DataModel as DefaultSheetDataModel);
var customnames = dtModel.GetCustomNameEnumerator();
while (customnames.MoveNext())
{
ExternalCellExpression expr = dtModel.GetCustomName(customnames.Current.ToString()) as ExternalCellExpression;
if (expr != null)
{
if (expr.Row == r && expr.Column == c)
{
dtModel.RemoveCustomName(customnames.Current.ToString());
fpTemplate.Sheets[0].SetText(r, c, null);
break;
}
}
}
}
// 设置单元格的只读属性
private void CellLock()
{
int r = fpTemplate.Sheets[0].ActiveRow;
int c = fpTemplate.Sheets[0].ActiveColumn;
FarPoint.Web.Spread.Model.ISheetStyleModel iss;
iss = (FarPoint.Web.Spread.Model.ISheetStyleModel)fpTemplate.Sheets[0].StyleModel;
StyleInfo newstyle = iss.GetCompositeInfo(r, c, 0, null);
FarPoint.Web.Spread.Model.CellRange cr = fpTemplate.Sheets[0].SelectionModel[0];
for (int i = 0; i < cr.RowCount; i++)
{
for (int j = 0; j < cr.ColumnCount; j++)
{
fpTemplate.Sheets[0].Cells[r+i, c+j].Locked = !newstyle.Locked;
}
}
}
// 删除动态行表单中设置的数据行
private void DeleteDataArea()
{
DefaultSheetDataModel dtModel = (fpTemplate.Sheets[0].DataModel as DefaultSheetDataModel);
dtModel.RemoveCustomName("DataArea");
// 删除数据行的同时,需要清空全部数据单元格
ClearDataFields();
}
// 设置动态行表单中的数据行
private void SetDataArea()
{
int r = fpTemplate.Sheets[0].ActiveRow;
DefaultSheetDataModel dtModel = (fpTemplate.Sheets[0].DataModel as DefaultSheetDataModel);
ExternalRangeExpression expr = dtModel.GetCustomName("DataArea") as ExternalRangeExpression;
if (expr != null)
{
DeleteDataArea();
}
dtModel.RemoveCustomName("DataArea");
dtModel.AddCustomName("DataArea", new ExternalRangeExpression(dtModel, r, -1, 1, 0));
}
// 清空全部数据单元格
private void ClearDataFields()
{
List<string> columns = DataTools.GetTemplateDataFields(hfTemplateID.Value);
DefaultSheetDataModel dtModel = (fpTemplate.Sheets[0].DataModel as DefaultSheetDataModel);
foreach (string col in columns)
{
ExternalCellExpression expr = dtModel.GetCustomName(col) as ExternalCellExpression;
if (expr != null)
{
dtModel.RemoveCustomName(col);
fpTemplate.Sheets[0].SetText(expr.Row, expr.Column, null);
}
}
}
#endregion
#region Spread操作
protected void fpTemplate_ButtonCommand(object sender, SpreadCommandEventArgs e)
{
if (e.CommandName.Equals("SaveTemplate"))
this.SaveTemplate();
else if (e.CommandName.Equals("FontBold"))
this.FontBold();
else if (e.CommandName.Equals("FontItalic"))
this.FontItalic();
else if (e.CommandName.Equals("FontUnderline"))
this.FontUnderline();
else if (e.CommandName.Equals("MergeCell"))
this.MergeCell();
else if (e.CommandName.Equals("InsertRow"))
this.InsertRow();
else if (e.CommandName.Equals("DeleteRow"))
this.DeleteRow();
else if (e.CommandName.Equals("InsertColumn"))
this.InsertColumn();
else if (e.CommandName.Equals("DeleteColumn"))
this.DeleteColumn();
else if (e.CommandName.Equals("AlignLeft"))
this.AlignLeft();
else if (e.CommandName.Equals("AlignCenter"))
this.AlignCenter();
else if (e.CommandName.Equals("AlignRight"))
this.AlignRight();
else if (e.CommandName.Equals("SetDataArea"))
this.SetDataArea();
else if (e.CommandName.Equals("DeleteDataArea"))
this.DeleteDataArea();
else if (e.CommandName.Equals("DeleteDataField"))
this.DeleteDataField();
else if (e.CommandName.Equals("CellLock"))
this.CellLock();
else if (e.CommandName.StartsWith("DataField."))
{
int n = e.CommandName.IndexOf(".") + 1;
this.SetDataField(e.CommandName.Substring(n));
}
else if (e.CommandName.StartsWith("ColWidth"))
{
int n = e.CommandName.IndexOf("-") + 1;
int size = int.Parse(e.CommandName.Substring(n));
this.ColWidth(size);
}
else if (e.CommandName.StartsWith("RowHeight"))
{
int n = e.CommandName.IndexOf("-") + 1;
int size = int.Parse(e.CommandName.Substring(n));
this.RowHeight(size);
}
else if (e.CommandName.StartsWith("FontName"))
{
int n = e.CommandName.IndexOf(".") + 1;
this.FontName(e.CommandName.Substring(n));
}
else if (e.CommandName.StartsWith("FontSize"))
{
int n = e.CommandName.IndexOf(".") + 1;
int size = int.Parse(e.CommandName.Substring(n));
this.FontSize(size);
}
else if (e.CommandName.StartsWith("BackColor"))
{
int n = e.CommandName.IndexOf(".") + 1;
Color bc = Color.FromName(e.CommandName.Substring(n));
this.BackColor(bc);
}
else if (e.CommandName.StartsWith("ForeColor"))
{
int n = e.CommandName.IndexOf(".") + 1;
Color fc = Color.FromName(e.CommandName.Substring(n));
this.ForeColor(fc);
}
else if (e.CommandName.StartsWith("LockColor"))
{
int n = e.CommandName.IndexOf(".") + 1;
string name = e.CommandName.Substring(n);
this.LockColor(name);
}
else if (e.CommandName.StartsWith("Protect"))
{
int n = e.CommandName.IndexOf(".") + 1;
string name = e.CommandName.Substring(n);
this.SetProtect(name);
}
}
#endregion
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/GrapeCity/dataprocess.git
git@gitee.com:GrapeCity/dataprocess.git
GrapeCity
dataprocess
dataprocess
master

搜索帮助