统一如何在手机上使用NPOI?

时间:2013-11-22 06:58:53

标签: android file-io unity3d npoi

我在Unity3d窗口上编写了代码,它运行正常。 但是当我将平台切换到ios时,它不起作用。 我想知道它是否适用于ios mobile?为什么不起作用?有谁知道如何解决它?

using System;
using System.Collections.Generic; 
using System.Text;
using System.IO;
using NPOI.HSSF.UserModel;
using NPOI.HPSF;
using NPOI.POIFS.FileSystem;
using NPOI.SS.UserModel;
using System.Security.Cryptography.X509Certificates;
public class test : MonoBehaviour {
     HSSFWorkbook hssfworkbook;
        Attachment attachment;
    public GUIText gui;
    // Use this for initialization
    void Start () {
        InitializeWorkbook();
        ISheet sheet1 = hssfworkbook.CreateSheet("Sheet1");
        sheet1.CreateRow(0).CreateCell(0).SetCellValue("This is a Sample");
        int x=1;
        for (int i = 1; i <= 25; i++)
        {
            IRow row=sheet1.CreateRow(i);
            for (int j = 0; j < 25; j++)
            {
                row.CreateCell(j).SetCellValue(x++);
            }
        }

        WriteToFile();
    SendEm();
    if(File .Exists(Application.dataPath+"/test.xls")){ 
        //File.Delete(Application.dataPath+"/test.xls");
    }
}
 void WriteToFile()
    {
        //Write the stream data of workbook to the root directory
        FileStream file = new FileStream(Application.persistentDataPath+"/test.xls", FileMode.Create);
        hssfworkbook.Write(file);
        file.Close();
    }
     void InitializeWorkbook()
    {
        hssfworkbook = new HSSFWorkbook();

        ////create a entry of DocumentSummaryInformation
        DocumentSummaryInformation dsi = PropertySetFactory.CreateDocumentSummaryInformation();
        dsi.Company = "NPOI Team";
        hssfworkbook.DocumentSummaryInformation = dsi;

        ////create a entry of SummaryInformation
        SummaryInformation si = PropertySetFactory.CreateSummaryInformation();
        si.Subject = "NPOI SDK Example";
        hssfworkbook.SummaryInformation = si;
    }
}

0 个答案:

没有答案