Esempio n. 1
0
        public void Export(OOExportBase OoXML, string ThemeRes, string ThemePath)
        {
            //ResourceSet set = new ResourceSet();

            // get a reference to the current assembly
            Assembly a = Assembly.GetExecutingAssembly();

            // get a list of resource names from the manifest
            string[] resNames = a.GetManifestResourceNames();

            Stream o = a.GetManifestResourceStream("FastReport.Export.OoXML.theme1.xml");

            int length    = 4096;
            int bytesRead = 0;

            Byte[] buffer = new Byte[length];

            // write the required bytes
            using (FileStream fs = new FileStream(OoXML.TempFolder + ThemePath, FileMode.OpenOrCreate))
            {
                do
                {
                    bytesRead = o.Read(buffer, 0, length);
                    fs.Write(buffer, 0, bytesRead);
                }while (bytesRead == length);
            }

            o.Dispose();
        }
Esempio n. 2
0
        public void Export(OOExportBase OoXML)
        {
            string Title   = OoXML.Report.ReportInfo.Name;
            string Author  = OoXML.Report.ReportInfo.Author;
            string Subject = OoXML.Report.ReportInfo.Description;

            if (Author.Length == 0)
            {
                Author = "FastReport.NET";
            }
            if (Title.Length == 0)
            {
                Title = OoXML.Report.FileName;
            }

            using (FileStream file = new FileStream(OoXML.TempFolder + "/" + FileName, FileMode.Create))
                using (StreamWriter Out = new StreamWriter(file))
                {
                    Out.WriteLine(xml_header);
                    Out.WriteLine("<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
                    Out.WriteLine("<dcterms:created xsi:type=\"dcterms:W3CDTF\">2009-06-17T07:33:19Z</dcterms:created>");
                    Out.WriteLine("<dc:title>" + Title + "</dc:title>");
                    if (Subject.Length != 0)
                    {
                        Out.WriteLine("<dc:subject>" + Subject + "</dc:subject>");
                    }
                    Out.WriteLine("<dc:creator>" + Author + "</dc:creator>");
                    Out.WriteLine("</cp:coreProperties>");
                }
        }
Esempio n. 3
0
        protected void ExportRelations(OOExportBase export_base)
        {
            if (FRelations.Count != 0)
            {
                string relation_dir_name  = export_base.TempFolder + "\\" + Path.GetDirectoryName(FileName) + "\\_rels\\";
                string relation_file_name = Path.GetFileName(FileName) + ".rels";
                string related_path       = "";

                if (!Directory.Exists(relation_dir_name))
                {
                    Directory.CreateDirectory(relation_dir_name);
                }

                using (FileStream file = new FileStream(relation_dir_name + relation_file_name, FileMode.Create))
                    using (StreamWriter Out = new StreamWriter(file))
                    {
                        Out.WriteLine(xml_header);
                        Out.WriteLine("<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
                        foreach (OoXMLBase relation_item in FRelations)
                        {
                            related_path = TranslatePath(FileName, relation_item.FileName) + Path.GetFileName(relation_item.FileName);

                            Out.WriteLine(
                                "<Relationship Id=" + Quoted(relation_item.rId) +
                                "Type=" + Quoted(relation_item.RelationType) +
                                "Target=" + Quoted(related_path) + "/>");
                        }
                        Out.WriteLine("</Relationships>");
                    }
            }
        }
Esempio n. 4
0
        public void Export(OOExportBase OoXML)
        {
            using (FileStream file = new FileStream(OoXML.TempFolder + "/" + FileName, FileMode.Create))
                using (StreamWriter Out = new StreamWriter(file))
                {
                    Out.WriteLine(xml_header);
                    Out.WriteLine("<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">");
                    Out.WriteLine("<DocSecurity>0</DocSecurity>");
                    Out.WriteLine("<ScaleCrop>false</ScaleCrop>");

                    // Heading description
                    Out.WriteLine("<HeadingPairs>");

                    Out.WriteLine("<vt:vector size=\"2\" baseType=\"variant\">");

                    Out.WriteLine("<vt:variant>");
                    Out.WriteLine("<vt:lpstr>Worksheets</vt:lpstr>");
                    Out.WriteLine("</vt:variant>");

                    Out.WriteLine("<vt:variant>");
                    Out.WriteLine("<vt:i4>2</vt:i4>");
                    Out.WriteLine("</vt:variant>");

                    Out.WriteLine("</vt:vector>");

                    Out.WriteLine("</HeadingPairs>");

                    // Titles description
                    Out.WriteLine("<TitlesOfParts>");
                    Out.WriteLine("<vt:vector size=\"1\" baseType=\"lpstr\">");
                    Out.WriteLine("<vt:lpstr>Ћист1</vt:lpstr>");
                    Out.WriteLine("</vt:vector>");
                    Out.WriteLine("</TitlesOfParts>");

                    Out.WriteLine("<LinksUpToDate>false</LinksUpToDate>");
                    Out.WriteLine("<SharedDoc>false</SharedDoc>");
                    Out.WriteLine("<HyperlinksChanged>false</HyperlinksChanged>");
                    Out.WriteLine("<AppVersion>12.0000</AppVersion>");

                    Out.WriteLine("</Properties>");
                }
        }