1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using UnityEngine;
- using System.Collections;
- using System.IO;
- using org.in2bits.MyXls;
- using System;
- using System.Collections.Generic;
- public class excelTest : MonoBehaviour {
- string path;
- TestInfo test1;
- TestInfo test2;
- TestInfo test3;
- List<TestInfo> listInfos;
- void Start()
- {
- ExcelMakerManager.CreateExcelMakerManager();
- //--测试数据
- test1 = new TestInfo();
- test1.id = "one";
- test1.name = "test1";
- test1.num = "x";
- test2 = new TestInfo();
- test2.id = "two";
- test2.name = "test2";
- test2.num = "22";
- test3 = new TestInfo();
- test3.id = "tree";
- test3.name = "test3";
- test3.num = "333";
- listInfos = new List<TestInfo>();
- listInfos.Add(test1);
- listInfos.Add(test2);
- listInfos.Add(test3);
- }
- void OnGUI()
- {
- if (GUI.Button(new Rect(100, 0, 100, 100), "aa"))
- {
- PrintExcel();
- }
- }
- /// <summary>
- /// 测试存储--文件存储位置Assets/Prints文件夹内
- /// </summary>
- public void PrintExcel()
- {
- Debug.Log("-- 存储Excel");
- if (!Directory.Exists(Application.dataPath + "/Prints"))
- {
- Directory.CreateDirectory(Application.dataPath + "/Prints");
- }
- path = Application.dataPath + "/Prints/Excel_"
- + System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".xls";
- ExcelMakerManager.eInstance.ExcelMaker(path, listInfos);
- }
- }
|