转Excel
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
using Excel;
using OfficeOpenXml;
using Excel.Core;
using System.Data;
using OfficeOpenXml.Style;
using UnityEditor;
using LitJson;
/// <summary>
/// 存储信息的
/// </summary>
class CopyInfo
{
public string CopyName;
public Vector3 CopyPosition;
public Quaternion CopyRotation;
public CopyInfo(string name, Vector3 postion, Vector3 rotation)
{
CopyName = name;
CopyPosition = postion;
CopyRotation = Quaternion.Euler(rotation);
}
}
public class CreateManager : MonoBehaviour
{
private List<CopyInfo> _copyInfoList;
private string _excelPath;
private string _path;
//1. 读文件
//2. 解析文件信息
//3. 实例化
//4. 实例化6额
//4.1 在3s中销毁一个并且添加一个
void Start () {
_path = Application.streamingAssetsPath + "/CopyInfo.txt";
_excelPath = Application.streamingAssetsPath + "/CopyInfo.xlsx";
_copyInfoList = new List<CopyInfo>();
// //Application.streamingAssetsPath 文件夹 streamingAssets
ReadFileToList(_copyInfoList,_path);
WriteExcel(_excelPath,_copyInfoList);
// Update is called once per frame
void Update () {
}
// 访问类型 返回值 方法名称 方法参数
private void ReadFileToList(List<CopyInfo> list, string path)
{
using (StreamReader reader = new StreamReader(path,Encoding.UTF8))
{
string tmpStr = string.Empty;
while ( ! string.IsNullOrEmpty(tmpStr = reader.ReadLine()))
{
string[] tmpInfos = tmpStr.Split('_');
list.Add(new CopyInfo(tmpInfos[0], StrToV3(tmpInfos[</
Json转Excel 和 Excel转Json
最新推荐文章于 2024-08-12 14:09:57 发布
本文介绍了如何将JSON数据转换为Excel电子表格,以及如何将Excel内容转换为JSON格式,详细阐述了转换过程和使用工具,对于数据处理和交换提供了有效的方法。
摘要由CSDN通过智能技术生成