1、spread控件展示的时候能不能显示那些快捷方式呢,比如:合并单元格、字体、背景、公式等 工具栏怎么调出来呢?研究了一两天,没有调出这个或许没有这个工具栏呢?
2、我在js中设置的合并单元格、字体、背景 在后台保存控件流的时候,这些设置的都保存不了。代码如下:
客户端代码如下:
js代码:
<script type="text/javascript">
function Button2_onclick() {
var spread = document.getElementById("FpSpread1");
var rc = spread.GetTotalRowCount();
var r = 0;
while (r != rc - 1) {
r1 = r;
var inc = 0;
while (r1 != -1) {
var val1 = spread.GetValue(r1, 1);
var val2 = spread.GetValue(r1 + 1, 1);
if (val1 == val2) {
inc++;
r1++;
}
else {
var cell = spread.GetCellByRowCol(r, 1);
cell.rowSpan = inc + 1;
r = r1 + 1;
r1 = -1;
}
}
}
alert('Cells with same values merged');
}
function Button1_onclick() {
var spread = document.all("FpSpread1");
var table = FpSpread1.all("FpSpread1_Viewport");
var tr = table.rows(spread.ActiveRow);
tr.bgColor = "Red";
var iActiveRow, iActiveCol;
//循环次数为 Spread 列数
for (var i = 0; i < 2; i++) {
iActiveRow = FpSpread1.ActiveRow;
var cell = FpSpread1.GetCellByRowCol(iActiveRow, i);
cell.setAttribute("FpCellType", "readonly");
}
}
</script>
html代码:
<FarPoint:FpSpread ID="FpSpread1" runat="server" BorderColor="Black" BorderStyle="Solid"
BorderWidth="1px" Height="300" Width="100%">
<CommandBar BackColor="Control" ButtonFaceColor="Control" ButtonHighlightColor="ControlLightLight"
ButtonShadowColor="ControlDark">
</CommandBar>
<Sheets>
<FarPoint:SheetView SheetName="Sheet1">
</FarPoint:SheetView>
</Sheets>
</FarPoint:FpSpread>
cs文件代码
保存:
MemoryStream msTemp = new MemoryStream();
FpSpread1.Save(msTemp,false);
string sql = "update tb_spread set text=:text where id=1";
OracleParameter[] paras = new OracleParameter[]
{
new OracleParameter("text",OracleType.Blob)
};
paras[0].Value = msTemp.GetBuffer();
SQLHelper.saveData(sql, paras);
读取流代码:
string sql = "select text from tb_spread where id=1";
byte[] buf = (byte[])SQLHelper.GetObject(sql);
MemoryStream msTemp = new MemoryStream(buf);
FpSpread1.Open(msTemp);
这里读取出来展示的js设置的东西都没有了。 |
|