Ejemplo n.º 1
0
        public void xmlDataWrite(Data.FileNode fileNode, string excelDirFullPathClient)
        {
            string fileName = fileNode.getFileName();

            for (int i = 0; i < fileNode.getTableNodeList().Count; i++)
            {
                string       sheetName   = fileNode.getTableNodeList()[i].getSheetName();
                string       xmlFileName = excelDirFullPathClient + @"\_table_" + fileName + "_" + sheetName + ".json";
                FileStream   fs          = new FileStream(xmlFileName, FileMode.OpenOrCreate);
                StreamWriter sw          = new StreamWriter(fs);
                //开始写入
                sw.Write(new JsonTableNodeWriter().GetClientString(fileNode.getTableNodeList()[i], @"_table_" + fileName + "_" + sheetName + ".json"));
                //清空缓冲区
                sw.Flush();
                //关闭流
                sw.Close();
                fs.Close();
            }
        }
Ejemplo n.º 2
0
        public string GetString(Data.FileNode fileNode)
        {
            string fileName  = fileNode.getFileName();
            string returnStr = "";

            for (int i = 0; i < fileNode.getTableNodeList().Count; i++)
            {
                string sheetName = fileNode.getTableNodeList()[i].getSheetName();
                returnStr = returnStr + GlobalData.getJsonFileBlock() + '"' + sheetName + '"' + ": ";
                returnStr = returnStr + new JsonTableNodeWriter().GetClientString(fileNode.getTableNodeList()[i], null);
                if (i != fileNode.getTableNodeList().Count - 1)
                {
                    returnStr = returnStr + ",\r\n";
                }
                else
                {
                    returnStr = returnStr + "\r\n";
                }
            }
            return(returnStr);
        }