Exemple #1
0
        private ExcelMapData get_or_create_index_map(ExcelMapData v_cur, Key v_key)
        {
            ExcelMapData rtn = v_cur.getData(v_key);

            if (rtn != null)
            {
                return(rtn);
            }
            switch (v_key.keytype)
            {
            case KeyType.Integer:
                rtn = new ExcelMapData();
                rtn.initAsTableData();
                v_cur.addData(v_key.ikey, rtn);
                break;

            case KeyType.String:
                rtn = new ExcelMapData();
                rtn.initAsTableData();
                v_cur.addData(v_key.skey, rtn);
                break;

            default:
                return(null);
            }
            Debug.Assert(rtn != null, string.Format("{0} 这个键暂时不支持", v_key.keytype));
            return(rtn);
        }
Exemple #2
0
        private void _get_row_data(Serchdata v_st, CellValue[] v_row_data, int v_optCode)
        {
            ExcelMapData           curmap  = v_st.curmap;
            ComplexExcelHeaderNode parrent = v_st.node;
            List <KeyValue <ComplexExcelHeaderNode> > keyValSet = v_st.node.getKeyValueSet();

            for (int i = 0; i < keyValSet.Count; i++)
            {
                Key the_key = keyValSet[i].key;
                ComplexExcelHeaderNode node = parrent.get_node(the_key);


                if (node.IsSkip)
                {
                    continue;
                }
                if (node.IsLeaf)
                {
                    ExcelHeaderDecorate ehd = m_header_dct[node.LeafDataIdx];
                    if (!ehd.is_need_opt(v_optCode))
                    {
                        continue;
                    }
                    CellValue celldata = v_row_data[node.LeafDataIdx];
                    if (!celldata._isMiss)
                    {
                        ExcelMapData leafData = new ExcelMapData();
                        leafData.initAsLeafeData(celldata);
                        leafData.Type = EExcelMapDataType.cellData;
                        curmap.addData(the_key, leafData);
                    }
                }
                else
                {
                    ExcelMapData map_next = new ExcelMapData();
                    map_next.initAsTableData();
                    map_next.Type = EExcelMapDataType.cellTable;
                    Serchdata sdnew = new Serchdata(node, map_next);
                    _get_row_data(sdnew, v_row_data, v_optCode);
                    if (!map_next.IsEmpty())
                    {
                        curmap.addData(the_key, map_next);
                    }
                }
            }
        }