/** constructor
         */
        public ExcelToJsonSheet()
        {
            //excel
            this.excel = null;

            //jsonitem_jsonsheet
            this.jsonitem_jsonsheet = null;
        }
Example #2
0
        public bool ExcelOpt(Excel_Base obj)
        {
            excel = obj;

            if (excel.isWrite) //写Excel
            {
                if (excel.fileName == null)
                {
                    if (SaveFile())
                    {
                        OutportExcel();
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    OutportExcel();
                    return(true);
                }
            }
            else //读Excel
            {
                if (excel.fileName == null)
                {
                    if (OpenFile())
                    {
                        ImportExcel();
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    ImportExcel();
                    return(true);
                }
            }
        }
        /** コンバート。
         */
        public bool Convert(File.Path a_path)
        {
            this.jsonitem_jsonsheet = new JsonItem.JsonItem(new Fee.JsonItem.Value_AssociativeArray());

            {
                                #if (USE_DEF_FEE_EXCELDATAREADER)
                {
                    this.excel = new Excel_ExcelDataReader();
                }
                                #else
                {
                    this.excel = new Excel_Dummy();
                }
                                #endif

                if (this.excel.ReadOpen(a_path) == true)
                {
                    int t_sheet_count = this.excel.GetSheetCount();
                    for (int ii = 0; ii < t_sheet_count; ii++)
                    {
                        if (this.excel.SetActiveSheet(ii) == true)
                        {
                            this.Convert_Sheet();
                        }
                    }
                    this.excel.Close();
                }
                else
                {
                    //失敗。
                    return(false);
                }
            }

            return(true);
        }