logic/parser/TableExcelExportJson.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using System.IO;
using System;
namespace tablegen2.logic
{
public static class TableExcelExportJson
{
public static void exportExcelFile(TableExcelData data, string filePath)
{
List<Dictionary<string, object>> lst = data.Rows.Select(a =>
{
var r = new Dictionary<string, object>();
for (int i = 0; i < data.Headers.Count; i++)
{
var hdr = data.Headers[i];
var val = a.StrList[i];
object obj = null;
switch (hdr.FieldType)
{
case "string":
obj = val;
break;
case "int":
{
int n = 0;
int.TryParse(val, out n);
obj = n;
}
break;
case "float":
{
float n = 0;
float.TryParse(val, out n);
obj = n;
}
break;
case "long":
{
long n = 0;
long.TryParse(val, out n);
obj = n;
}
break;
case "string[]":
{
string[] strs;
var numStrs = val.Split(';');
strs = new string[numStrs.Length];
for (int j = 0; j < numStrs.Length; j++)
{
if (string.IsNullOrEmpty(numStrs[j]))
strs[j] = "";
后面还有 62 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。