Esempio n. 1
0
        private void bpaste_Click(object sender, EventArgs e)
        {
            // Paste
            if (subreportedit.SelectedSection == null)
            {
                MessageBox.Show("Select a destination section first");
                return;
            }
            if (!Clipboard.ContainsText())
            {
                MessageBox.Show("Clipboard data not valid");
                return;
            }
            string ntext = Clipboard.GetText().Trim();

            if (ntext.Length < 10)
            {
                MessageBox.Show("Clipboard content not valid");
                return;
            }
            if (ntext.Substring(0, 8) != "<SECTION")
            {
                MessageBox.Show("Clipboard content not valid");
                return;
            }
            Section sec     = subreportedit.SelectedSection;
            Report  nreport = new Report();
            {
                ReportReader rreader = new ReportReader(nreport);
                {
                    List <PrintPosItem> nlist = rreader.ReadFromString(ntext);
                    foreach (PrintPosItem xitem in nlist)
                    {
                        // Validate name
                        if (FReport.Components.IndexOfKey(xitem.Name) >= 0)
                        {
                            FReport.GenerateNewName(xitem);
                        }
                        FReport.Components.Add(xitem.Name, xitem);
                        sec.Components.Add(xitem);
                        xitem.Section = sec;
                    }
                    subreportedit.Redraw();
                    // Select recently added items
                    subreportedit.ClearSelection();
                    foreach (PrintPosItem xitem in nlist)
                    {
                        subreportedit.SelectedItems.Add(xitem.SelectionIndex, xitem);
                    }
                }
            }
            BandInfo nband = subreportedit.BandsList[sec.SelectionIndex];

            subreportedit.SelectedItemsBands.Add(sec.SelectionIndex, nband);
            subreportedit.SelectPosItem();
            AfterSelectDesign(this, null);
            subreportedit.parentcontrol.Invalidate();
        }