using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using NPOI.SS.UserModel;
namespace TapXIYOU_Utility
{
public partial class Form1 : Form
{
private string excelFileFullNameStr = "";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
excelFileFullNameStr = openFileDialog1.FileName;
/*
System.IO.StreamReader sr = new
System.IO.StreamReader(openFileDialog1.FileName);
MessageBox.Show(sr.ReadToEnd());
sr.Close();
*/
}
//
//NewBehaviourScript temp = new NewBehaviourScript();
//temp.Start();
}
private void button_Skill_Click(object sender, EventArgs e)
{
//
if ("" == excelFileFullNameStr)
{
return;
}
//
FileStream stream = File.Open(excelFileFullNameStr, FileMode.Open, FileAccess.ReadWrite);
IWorkbook workbook = WorkbookFactory.Create(stream);
stream.Close();
ISheet sheet = workbook.GetSheetAt(0);
string[] orgSkillEffectStrArray = {"提升该英雄每秒伤害"};
string[] finalSkillEffectStrArray = {"提升英雄每秒伤害加成"};
int targetColumnArrayIndex = 5;
int rowStartArrayIndex = 1;
int rows = sheet.LastRowNum;
for (int i = rowStartArrayIndex; i < rows; i++)
{
string nvalue = sheet.GetRow(i).GetCell(targetColumnArrayIndex).ToString();
for (int j = 0; j < orgSkillEffectStrArray.Length; ++j)
{
if (true == nvalue.Contains(orgSkillEffectStrArray[j]))
{
sheet.GetRow(i).GetCell(targetColumnArrayIndex).SetCellValue("HAHAHA");
Debug.WriteLine(sheet.GetRow(i).GetCell(targetColumnArrayIndex).ToString());
//result.Tables[tablesArrayIndex].Rows[i][targetColumnArrayIndex] =
}
}
}
FileStream wStream = File.Open(excelFileFullNameStr, FileMode.Create, FileAccess.ReadWrite);
workbook.Write(wStream);
wStream.Close();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using NPOI.SS.UserModel;
namespace TapXIYOU_Utility
{
public partial class Form1 : Form
{
private string excelFileFullNameStr = "";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
excelFileFullNameStr = openFileDialog1.FileName;
/*
System.IO.StreamReader sr = new
System.IO.StreamReader(openFileDialog1.FileName);
MessageBox.Show(sr.ReadToEnd());
sr.Close();
*/
}
//
//NewBehaviourScript temp = new NewBehaviourScript();
//temp.Start();
}
private void button_Skill_Click(object sender, EventArgs e)
{
//
if ("" == excelFileFullNameStr)
{
return;
}
//
FileStream stream = File.Open(excelFileFullNameStr, FileMode.Open, FileAccess.ReadWrite);
IWorkbook workbook = WorkbookFactory.Create(stream);
stream.Close();
ISheet sheet = workbook.GetSheetAt(0);
string[] orgSkillEffectStrArray = {"提升该英雄每秒伤害"};
string[] finalSkillEffectStrArray = {"提升英雄每秒伤害加成"};
int targetColumnArrayIndex = 5;
int rowStartArrayIndex = 1;
int rows = sheet.LastRowNum;
for (int i = rowStartArrayIndex; i < rows; i++)
{
string nvalue = sheet.GetRow(i).GetCell(targetColumnArrayIndex).ToString();
for (int j = 0; j < orgSkillEffectStrArray.Length; ++j)
{
if (true == nvalue.Contains(orgSkillEffectStrArray[j]))
{
sheet.GetRow(i).GetCell(targetColumnArrayIndex).SetCellValue("HAHAHA");
Debug.WriteLine(sheet.GetRow(i).GetCell(targetColumnArrayIndex).ToString());
//result.Tables[tablesArrayIndex].Rows[i][targetColumnArrayIndex] =
}
}
}
FileStream wStream = File.Open(excelFileFullNameStr, FileMode.Create, FileAccess.ReadWrite);
workbook.Write(wStream);
wStream.Close();
}
}
}