コード例 #1
0
ファイル: PreparedPage.cs プロジェクト: satem02/FastReport
        public void PasteObjects(XmlItem objects, float x, float y)
        {
            if (objects.Count > 0)
            {
                // get the top object's location
                float pastedY = (objects[0].GetProp("t") != "") ?
                                Converter.StringToFloat(objects[0].GetProp("t")) : 0;

                float deltaX = x;
                float deltaY = y - pastedY;

                while (objects.Count > 0)
                {
                    XmlItem obj = objects[0];

                    // shift the object's location
                    float objX = (obj.GetProp("l") != "") ?
                                 Converter.StringToFloat(obj.GetProp("l")) : 0;
                    float objY = (obj.GetProp("t") != "") ?
                                 Converter.StringToFloat(obj.GetProp("t")) : 0;
                    obj.SetProp("l", Converter.ToString(objX + deltaX));
                    obj.SetProp("t", Converter.ToString(objY + deltaY));

                    // add object to a page
                    xmlItem.AddItem(obj);
                }
            }
        }
コード例 #2
0
        public XmlItem CutObjects(int index)
        {
            XmlItem result = new XmlItem();

            while (xmlItem.Count > index)
            {
                result.AddItem(xmlItem[index]);
            }
            return(result);
        }
コード例 #3
0
ファイル: LabelWizardForm.cs プロジェクト: zixing131/LAEACC
 private void btnCustom_Click(object sender, EventArgs e)
 {
     using (CustomLabelForm form = new CustomLabelForm())
     {
         XmlItem customManufacturer = FLabels.Root[FLabels.Root.Count - 1];
         form.Init(Res.Get("Forms,LabelWizard,Label") + (customManufacturer.Count + 1).ToString());
         if (form.ShowDialog() == DialogResult.OK)
         {
             customManufacturer.AddItem(form.LabelParameters);
             cbxLabels.SelectedIndex = cbxLabels.Items.Count - 1;
             cbxLabels_SelectedIndexChanged(this, EventArgs.Empty);
             lbxLabels.SelectedIndex = lbxLabels.Items.Count - 1;
         }
     }
 }
コード例 #4
0
        /// <summary>
        /// Saves prepared pages to a stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public void Save(Stream stream)
        {
            stream = Compressor.Compress(stream);

            using (XmlDocument doc = new XmlDocument())
            {
                doc.AutoIndent = true;
                doc.Root.Name  = "preparedreport";
                XmlItem pages = doc.Root.Add();
                pages.Name = "pages";

                // attach each page's xml to the doc
                foreach (PreparedPage page in FPreparedPages)
                {
                    pages.AddItem(page.Xml);
                }

                XmlItem sourcePages = doc.Root.Add();
                sourcePages.Name = "sourcepages";
                SourcePages.Save(sourcePages);

                XmlItem dictionary = doc.Root.Add();
                dictionary.Name = "dictionary";
                Dictionary.Save(dictionary);

                XmlItem bookmarks = doc.Root.Add();
                bookmarks.Name = "bookmarks";
                Bookmarks.Save(bookmarks);

                doc.Root.AddItem(Outline.Xml);

                XmlItem blobStore = doc.Root.Add();
                blobStore.Name = "blobstore";
                BlobStore.Save(blobStore);

                doc.Save(stream);

                // detach each page's xml from the doc
                foreach (PreparedPage page in FPreparedPages)
                {
                    page.Xml.Parent = null;
                }
                Outline.Xml.Parent = null;
            }

            stream.Dispose();
        }
コード例 #5
0
        /// <summary>
        /// Saves prepared pages to a stream.
        /// </summary>
        /// <param name="stream">The stream to save to.</param>
        public void Save(Stream stream)
        {
            if (Config.PreparedCompressed)
            {
                stream = Compressor.Compress(stream);
            }

            using (XmlDocument doc = new XmlDocument())
            {
                doc.AutoIndent = true;
                doc.Root.Name  = "preparedreport";

                // save ReportInfo
                doc.Root.SetProp("ReportInfo.Name", Report.ReportInfo.Name);
                doc.Root.SetProp("ReportInfo.Author", Report.ReportInfo.Author);
                doc.Root.SetProp("ReportInfo.Description", Report.ReportInfo.Description);
                doc.Root.SetProp("ReportInfo.Created", SystemFake.DateTime.Now.ToString());
                doc.Root.SetProp("ReportInfo.Modified", SystemFake.DateTime.Now.ToString());
                doc.Root.SetProp("ReportInfo.CreatorVersion", Report.ReportInfo.CreatorVersion);

                XmlItem pages = doc.Root.Add();
                pages.Name = "pages";

                // attach each page's xml to the doc
                foreach (PreparedPage page in preparedPages)
                {
                    page.Load();
                    pages.AddItem(page.Xml);
                }

                XmlItem sourcePages = doc.Root.Add();
                sourcePages.Name = "sourcepages";
                SourcePages.Save(sourcePages);

                XmlItem dictionary = doc.Root.Add();
                dictionary.Name = "dictionary";
                Dictionary.Save(dictionary);

                XmlItem bookmarks = doc.Root.Add();
                bookmarks.Name = "bookmarks";
                Bookmarks.Save(bookmarks);

                doc.Root.AddItem(Outline.Xml);

                XmlItem blobStore = doc.Root.Add();
                blobStore.Name = "blobstore";
                BlobStore.Save(blobStore);

                doc.Save(stream);

                // detach each page's xml from the doc
                foreach (PreparedPage page in preparedPages)
                {
                    page.Xml.Parent = null;
                    page.ClearUploadedXml();
                }
                Outline.Xml.Parent = null;
            }

            if (Config.PreparedCompressed)
            {
                stream.Dispose();
            }
        }