Json转Excel 和 Excel转Json

本文介绍了如何将JSON数据转换为Excel电子表格,以及如何将Excel内容转换为JSON格式,详细阐述了转换过程和使用工具,对于数据处理和交换提供了有效的方法。
摘要由CSDN通过智能技术生成
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[</
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值