Ejemplo n.º 1
0
        void ADD_Click(object sender, EventArgs e)
        {
            NewFile _newfile = new NewFile();

            _newfile.ShowDialog();
            Nameaddfile = _newfile.name;
            fullpathadd = pathaddfile + @"\" + _nameaddfile + ".xls";
            //---- xu ly coi no o node nao moi dc

            int index = pathaddfile.LastIndexOf(@"\");

            if (index != -1)
            {
                string nodecantim = pathaddfile.Substring(index + 1);
                int    countnode  = Nodes[0].Nodes.Count;
                for (int i = 0; i < countnode; i++)
                {
                    if (Nodes[0].Nodes[i].Text == nodecantim)
                    {
                        Nodes[0].Nodes[i].Nodes.Add(_nameaddfile + ".xls");
                    }
                }
            }

            //create new xls file
            string    file      = duongdanfulladd;
            Workbook  workbook  = new Workbook();
            Worksheet worksheet = new Worksheet(_nameaddfile);

            worksheet.Cells.ColumnWidth[0, 1] = 3000;
            workbook.Worksheets.Add(worksheet);
            workbook.Save(file);
        }
Ejemplo n.º 2
0
        void ADD_Click(object sender, EventArgs e)
        {
            NewFile _newfile = new NewFile();
            _newfile.ShowDialog();
            Nameaddfile = _newfile.name;
            fullpathadd = pathaddfile + @"\" + _nameaddfile+".xls";
            //---- xu ly coi no o node nao moi dc

            int index = pathaddfile.LastIndexOf(@"\");
            if (index != -1)
            {

               string nodecantim =  pathaddfile.Substring(index+1);
               int countnode = Nodes[0].Nodes.Count;
               for (int i = 0; i < countnode; i++)
               {
                   if (Nodes[0].Nodes[i].Text == nodecantim)
                   {
                       Nodes[0].Nodes[i].Nodes.Add(_nameaddfile+".xls");
                   }
               }

            }

            //create new xls file
            string file = duongdanfulladd;
            Workbook workbook = new Workbook();
            Worksheet worksheet = new Worksheet(_nameaddfile);
            worksheet.Cells.ColumnWidth[0, 1] = 3000;
            workbook.Worksheets.Add(worksheet);
            workbook.Save(file);
        }