Пример #1
0
 private string GetOneCellText(FarPoint.Win.Spread.SheetView sheet, string tagStr)
 {
     FarPoint.Win.Spread.Cell cell = sheet.GetCellFromTag(null, tagStr);
     if (cell != null)
     {
         return(cell.Text);
     }
     return(string.Empty);
 }
Пример #2
0
 /// <summary>
 /// 设置单个Cell的Text
 /// </summary>
 /// <param name="sheet">SheetView</param>
 /// <param name="tagStr">Cell的tag</param>
 /// <param name="strText">要显示的Text</param>
 private void SetOneCellText(FarPoint.Win.Spread.SheetView sheet, string tagStr, string strText)
 {
     FarPoint.Win.Spread.Cell cell = sheet.GetCellFromTag(null, tagStr);
     if (cell != null)
     {
         FarPoint.Win.Spread.CellType.TextCellType t = new FarPoint.Win.Spread.CellType.TextCellType();
         t.Multiline   = true;
         t.WordWrap    = true;
         cell.CellType = t;
         cell.Text    += strText;
     }
 }
Пример #3
0
 /// <summary>
 /// 设置单个Cell的Text
 /// </summary>
 /// <param name="sheet">SheetView</param>
 /// <param name="tagStr">Cell的tag</param>
 /// <param name="strText">要显示的Text</param>
 private void SetOneCellText(FarPoint.Win.Spread.SheetView sheet, string tagStr, string strText)
 {
     FarPoint.Win.Spread.Cell cell = sheet.GetCellFromTag(null, tagStr);
     if (cell != null)
     {
         FarPoint.Win.Spread.CellType.TextCellType t = new FarPoint.Win.Spread.CellType.TextCellType();
         t.Multiline   = true;
         t.WordWrap    = true;
         cell.CellType = t;
         //把字符串转换成数字进行相加,成功后转回字符串
         try
         {
             if (cell.Text == string.Empty || cell.Text == null)
             {
                 cell.Text = "0";
             }
             if (strText == string.Empty || strText == null)
             {
                 strText = "0";
             }
             decimal intText = (Convert.ToDecimal(cell.Text) + Convert.ToDecimal(strText));
             cell.Text = intText.ToString();
         }
         //如果转换失败则把字符串相加
         catch
         {
             if (cell.Text == "0")
             {
                 cell.Text = "";
             }
             if (strText == "0")
             {
                 strText = "";
             }
             cell.Text += strText;
         }
         //相加结果为零,变成空字符串
         if (cell.Text == "0")
         {
             cell.Text = "";
         }
         //      cell.Text += strText;
     }
 }