本文整理汇总了C#中System.StringHelper.GetPlitString方法的典型用法代码示例。如果您正苦于以下问题:C# StringHelper.GetPlitString方法的具体用法?C# StringHelper.GetPlitString怎么用?C# StringHelper.GetPlitString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.StringHelper
的用法示例。
在下文中一共展示了StringHelper.GetPlitString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillMutilRows
public void FillMutilRows(ExcelAccess ea, int i, LP_Temple lp, string str, List<int> arrCellCount, string[] arrCellPos)
{
StringHelper help = new StringHelper();
str = help.GetPlitString(str, arrCellCount[1]);
string[] extraWord = lp.ExtraWord.Split(pchar);
string[] arrRst = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
int j = 0;
for (; i < arrCellPos.Length; i++)
{
if (j >= arrRst.Length)
break;
ea.SetCellValue(arrRst[j], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i]))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue;
tfv.ControlValue = arrRst[j];
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellPos[i])[0];
tfv.YExcelPos = GetCellPos(arrCellPos[i])[1];
tfv.ExcelSheetName = activeSheetName;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = arrRst[j];
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellPos[i])[0];
tfv.YExcelPos = GetCellPos(arrCellPos[i])[1];
tfv.ExcelSheetName = activeSheetName;
valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv);
}
j++;
}
}
示例2: ContentChanged
//.........这里部分代码省略.........
{
for (int j = 0; j < arrCellpos.Length; j++)
{
if (str.IndexOf("\r\n") == -1 && str.Length <= help.GetFristLen(str, arrCellCount[j]))
{
string strNew = str.Substring(0, (str.Length > 0 ? str.Length : 1) - 1) + (j + 1).ToString();
ea.SetCellValue(strNew, GetCellPos(arrCellpos[j])[0], GetCellPos(arrCellpos[j])[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + arrCellpos[j]))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellpos[j]] as WF_TableFieldValue;
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[j])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[j])[1];
tfv.ExcelSheetName = sheet.Name;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[j])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[j])[1];
tfv.ExcelSheetName = sheet.Name;
valuehs.Add(lp.LPID + "$" + arrCellpos[j], tfv);
}
}
}
return;
}
int i = 0;
if (arrCellCount[0] != arrCellCount[1])
{
if (str.IndexOf("\r\n") == -1 && str.Length <= help.GetFristLen(str, arrCellCount[0]))
{
ea.SetCellValue(str, GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + arrCellpos[0]))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellpos[0]] as WF_TableFieldValue;
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[0])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[0])[1];
tfv.ExcelSheetName = sheet.Name;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[0])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[0])[1];
tfv.ExcelSheetName = sheet.Name;
valuehs.Add(lp.LPID + "$" + arrCellpos[0], tfv);
}
return;
}
ea.SetCellValue(str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0])),
GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + arrCellpos[0]))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellpos[0]] as WF_TableFieldValue;
tfv.ControlValue = str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0]));
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[0])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[0])[1];
tfv.ExcelSheetName = sheet.Name;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0]));
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[0])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[0])[1];
tfv.ExcelSheetName = sheet.Name;
valuehs.Add(lp.LPID + "$" + arrCellpos[0], tfv);
}
str = str.Substring(help.GetFristLen(str, arrCellCount[0]) >= str.IndexOf("\r\n") &&
str.IndexOf("\r\n") != -1 ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0]));
i++;
}
str = help.GetPlitString(str, arrCellCount[1]);
FillMutilRows(ea, i, lp, str, arrCellCount, arrCellpos);
}
LockExcel(wb,sheet);
}
示例3: ctrl_Leave
//.........这里部分代码省略.........
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[0])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[0])[1];
tfv.ExcelSheetName = xx.Name;
valuehs.Add(lp.LPID + "$" + arrCellpos[0], tfv);
}
LockExcel(wb, xx);
return;
}
ea.SetCellValue(str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0])),
GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + arrCellpos[0]))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellpos[0]] as WF_TableFieldValue;
tfv.ControlValue = (str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0])));
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[0])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[0])[1];
tfv.ExcelSheetName = xx.Name;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = (str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0])));
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[0])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[0])[1];
tfv.ExcelSheetName = xx.Name;
valuehs.Add(lp.LPID + "$" + arrCellpos[0], tfv);
}
str = str.Substring(help.GetFristLen(str, arrCellCount[0]) >= str.IndexOf("\r\n") &&
str.IndexOf("\r\n") != -1 ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0]));
i++;
}
str = help.GetPlitString(str, arrCellCount[1]);
FillMutilRows(ea, i, lp, str, arrCellCount, arrCellpos);
}
if (lp.CellName == "单位")
{
IList list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select OrgCode from mOrg where OrgName='" + str + "'");
if (list.Count > 0)
{
switch (kind)
{
case "电力线路第一种工作票":
case "yzgzp":
strNumber = "07" + System.DateTime.Now.Year.ToString() + list[0].ToString().Substring(list[0].ToString().Length - 2, 2);
break;
case "电力线路第二种工作票":
case "ezgzp":
strNumber = "08" + System.DateTime.Now.Year.ToString() + list[0].ToString().Substring(list[0].ToString().Length - 2, 2);
break;
case "电力线路倒闸操作票":
case "dzczp":
strNumber = "BJ" + System.DateTime.Now.Year.ToString();
break;
case "电力线路事故应急抢修单":
case "xlqxp":
strNumber = list[0].ToString().Substring(list[0].ToString().Length - 2, 2) + System.DateTime.Now.Year.ToString();
break;
default:
strNumber = "07" + System.DateTime.Now.Year.ToString() + list[0].ToString().Substring(list[0].ToString().Length - 2, 2);
break;
}
IList<LP_Record> listLPRecord = ClientHelper.PlatformSqlMap.GetList<LP_Record>("SelectLP_RecordList", " where kind = '" + kind + "' and number like '" + strNumber + "%'");
if (kind == "yzgzp")
{
strNumber += (listLPRecord.Count + 1).ToString().PadLeft(3, '0') + "-1";
}
else
{
strNumber += (listLPRecord.Count + 1).ToString().PadLeft(3, '0');
}
if (ctrlNumber != null)
{
ctrlNumber.Text = strNumber;
currRecord.Number = ctrlNumber.Text;
}
if (currRecord!=null) currRecord.OrgName = str;
//ContentChanged(ctrlNumber);
}
}
LockExcel(wb, xx);
}
示例4: FillMutilRows
public void FillMutilRows(ExcelAccess ea, int i, LP_Temple lp, string str, List<int> arrCellCount, string[] arrCellPos)
{
StringHelper help = new StringHelper();
str = help.GetPlitString(str, arrCellCount[1]);
string[] extraWord = lp.ExtraWord.Split(pchar);
string[] arrRst = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
int j = 0;
for (; i < arrCellPos.Length; i++)
{
if (j >= arrRst.Length)
break;
ea.SetCellValue(arrRst[j], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]);
j++;
}
}
示例5: ctrl_Leave
void ctrl_Leave(object sender, EventArgs e)
{
unLockExcel();
LP_Temple lp = (LP_Temple)(sender as Control).Tag;
string str = (sender as Control).Text;
if (dsoFramerWordControl1.MyExcel==null)
{
return;
}
Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
ExcelAccess ea = new ExcelAccess();
ea.MyWorkBook = wb;
ea.MyExcel=wb.Application;
if (lp.CtrlType.Contains("uc_gridcontrol"))
{
FillTable(ea, lp, (sender as uc_gridcontrol).GetContent(String2Int(lp.WordCount.Split(pchar))));
LockExcel();
return;
}
else if (lp.CtrlType.Contains("DevExpress.XtraEditors.DateEdit"))
{
FillTime(ea, lp, (sender as DateEdit).DateTime);
LockExcel();
return;
}
string[] arrCellpos = lp.CellPos.Split(pchar);
string[] arrtemp = lp.WordCount.Split(pchar);
arrCellpos = StringHelper.ReplaceEmpty(arrCellpos).Split(pchar);
string[] extraWord = lp.ExtraWord.Split(pchar);
List<int> arrCellCount = String2Int(arrtemp);
if (arrCellpos.Length == 1||string.IsNullOrEmpty(arrCellpos[1]))
ea.SetCellValue(str, GetCellPos(lp.CellPos)[0], GetCellPos(lp.CellPos)[1]);
else if(arrCellpos.Length>1&&(!string.IsNullOrEmpty(arrCellpos[1])))
{
StringHelper help = new StringHelper();
if (lp.CellName == "编号")
{
for (int j = 0; j < arrCellpos.Length; j++)
{
if (str.IndexOf("\r\n") == -1 && str.Length <= help.GetFristLen(str, arrCellCount[j])&&str!="" )
{
string strNew = str.Substring(0, str.Length - 1) + (j + 1).ToString();
ea.SetCellValue(strNew, GetCellPos(arrCellpos[j])[0], GetCellPos(arrCellpos[j])[1]);
}
}
LockExcel();
return;
}
int i = 0;
if (arrCellCount[0] != arrCellCount[1])
{
if (str.IndexOf("\r\n") == -1 && str.Length <= help.GetFristLen(str, arrCellCount[0]))
{
ea.SetCellValue(str, GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
LockExcel();
return;
}
ea.SetCellValue(str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0])),
GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
str = str.Substring(help.GetFristLen(str, arrCellCount[0]) >= str.IndexOf("\r\n") &&
str.IndexOf("\r\n") != -1 ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0]));
i++;
}
str = help.GetPlitString(str, arrCellCount[1]);
FillMutilRows(ea, i, lp, str, arrCellCount, arrCellpos);
}
if (lp.CellName == "单位")
{
IList list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select OrgCode from mOrg where OrgName='" + str + "'");
if (ctrlOrgName != null) ctrlOrgName.Text = str;
if (list.Count > 0)
{
switch (kind)
{
case "yzgzp":
strNumber = "07" + System.DateTime.Now.Year.ToString() + list[0].ToString().Substring(list[0].ToString().Length - 2, 2);
break;
case "ezgzp":
strNumber = "08" + System.DateTime.Now.Year.ToString() + list[0].ToString().Substring(list[0].ToString().Length - 2, 2);
break;
case "dzczp":
strNumber = "BJ" + System.DateTime.Now.Year.ToString();
break;
case "xlqxp":
strNumber = list[0].ToString().Substring(list[0].ToString().Length - 2, 2) + System.DateTime.Now.Year.ToString();
break;
default:
strNumber = "07" + System.DateTime.Now.Year.ToString() + list[0].ToString().Substring(list[0].ToString().Length - 2, 2);
break;
}
IList<LP_Record> listLPRecord = ClientHelper.PlatformSqlMap.GetList<LP_Record>("SelectLP_RecordList", " where kind = '" + kind + "' and number like '" + strNumber + "%'");
if (kind == "yzgzp")
{
strNumber += (listLPRecord.Count + 1).ToString().PadLeft(3, '0') + "-1";
}
else
//.........这里部分代码省略.........
示例6: ContentChanged
void ContentChanged(Control ctrl)
{
LP_Temple lp = (LP_Temple)ctrl.Tag;
string str = ctrl.Text;
if (dsoFramerWordControl1.MyExcel == null)
{
return;
}
unLockExcel();
Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
ExcelAccess ea = new ExcelAccess();
ea.MyWorkBook = wb;
ea.MyExcel = wb.Application;
if (lp.CtrlType.Contains("uc_gridcontrol"))
{ FillTable(ea, lp, (ctrl as uc_gridcontrol).GetContent(String2Int(lp.WordCount.Split(pchar)))); return; }
else if (lp.CtrlType.Contains("DevExpress.XtraEditors.DateEdit"))
{
FillTime(ea, lp, (ctrl as DateEdit).DateTime);
return;
}
string[] arrCellpos = lp.CellPos.Split(pchar);
string[] arrtemp = lp.WordCount.Split(pchar);
arrCellpos = StringHelper.ReplaceEmpty(arrCellpos).Split(pchar);
arrtemp = StringHelper.ReplaceEmpty(arrtemp).Split(pchar);
List<int> arrCellCount = String2Int(arrtemp);
if (arrCellpos.Length == 1 || string.IsNullOrEmpty(arrCellpos[1]))
ea.SetCellValue(str, GetCellPos(lp.CellPos)[0], GetCellPos(lp.CellPos)[1]);
else if (arrCellpos.Length > 1 && (!string.IsNullOrEmpty(arrCellpos[1])))
{
StringHelper help = new StringHelper();
if (lp.CellName == "编号")
{
for (int j = 0; j < arrCellpos.Length; j++)
{
if (str.IndexOf("\r\n") == -1 && str.Length <= help.GetFristLen(str, arrCellCount[j]))
{
string strNew = str.Substring(0, (str.Length>0?str.Length:1)- 1) + (j + 1).ToString();
ea.SetCellValue(strNew, GetCellPos(arrCellpos[j])[0], GetCellPos(arrCellpos[j])[1]);
}
}
return;
}
int i = 0;
if (arrCellCount[0] != arrCellCount[1])
{
if (str.IndexOf("\r\n") == -1 && str.Length <= help.GetFristLen(str, arrCellCount[0]))
{
ea.SetCellValue(str, GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
return;
}
ea.SetCellValue(str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0])),
GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
str = str.Substring(help.GetFristLen(str, arrCellCount[0]) >= str.IndexOf("\r\n") &&
str.IndexOf("\r\n") != -1 ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0]));
i++;
}
str = help.GetPlitString(str, arrCellCount[1]);
FillMutilRows(ea, i, lp, str, arrCellCount, arrCellpos);
}
LockExcel();
}
示例7: ctrl_Leave
void ctrl_Leave(object sender, EventArgs e)
{
LP_Temple lp = (LP_Temple)(sender as Control).Tag;
string str = (sender as Control).Text;
Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
ExcelAccess ea = new ExcelAccess();
ea.MyWorkBook = wb;
ea.MyExcel=wb.Application;
if (lp.CtrlType.Contains("uc_gridcontrol"))
{ FillTable(ea, lp, (sender as uc_gridcontrol).GetContent(String2Int(lp.WordCount.Split(pchar)))); return; }
else if (lp.CtrlType.Contains("DevExpress.XtraEditors.DateEdit"))
{ FillTime(ea, lp, (sender as DateEdit).DateTime); return; }
string[] arrCellpos = lp.CellPos.Split(pchar);
string[] arrtemp = lp.WordCount.Split(pchar);
List<int> arrCellCount = String2Int(arrtemp);
if (arrCellpos.Length == 1)
ea.SetCellValue(str, GetCellPos(lp.CellPos)[0], GetCellPos(lp.CellPos)[1]);
else if(arrCellpos.Length>1)
{
StringHelper help = new StringHelper();
int i = 0;
if (arrCellCount[0] != arrCellCount[1])
{
if (str.IndexOf("\r\n") == -1 && str.Length <= help.GetFristLen(str, arrCellCount[0]))
{
ea.SetCellValue(str, GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
return;
}
ea.SetCellValue(str.Substring(0, str.IndexOf("\r\n") != -1 && help.GetFristLen(str, arrCellCount[0]) >=
str.IndexOf("\r\n") ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0])),
GetCellPos(arrCellpos[0])[0], GetCellPos(arrCellpos[0])[1]);
str = str.Substring(help.GetFristLen(str, arrCellCount[0]) >= str.IndexOf("\r\n") &&
str.IndexOf("\r\n") != -1 ? str.IndexOf("\r\n") : help.GetFristLen(str, arrCellCount[0]));
i++;
}
str = help.GetPlitString(str, arrCellCount[1]);
FillMutilRows(ea, i, lp, str, arrCellCount, arrCellpos);
}
}