Ejemplo n.º 1
0
        public string BuildIndex()
        {
            string tmp = Path.GetTempPath();
            SingleFileAttachment sfa = new SingleFileAttachment(tmp);

            sfa.Name    = "Workbook.html";
            sfa.UseName = "Workbook.html";

            string index = this.BuildAttachmentHeader(sfa);

            index += Environment.NewLine;

            //string links = string.Empty;
            string sheets = string.Empty;

            foreach (SingleFileAttachment att in this.Attachments)
            {
                if (att.UseName.StartsWith("Sheet"))
                {
                    //links += att.GetWorksheetLink();
                    sheets += att.GetWorksheetXML();
                }
            }

            index += string.Format(INDEX_TEMPLATE, sheets);
            index += Environment.NewLine;
            return(index);
        }
Ejemplo n.º 2
0
        public string BuildFileList()
        {
            string tmp = Path.GetTempPath();
            SingleFileAttachment sfa = new SingleFileAttachment(tmp);

            sfa.Name    = "filelist.xml";
            sfa.RelPath = "Worksheets";
            sfa.UseName = "filelist.xml";

            string fileList = this.BuildAttachmentHeader(sfa);

            fileList += Environment.NewLine;


            string files = string.Empty;

            foreach (SingleFileAttachment att in this.Attachments)
            {
                files += @" <o:File HRef=3D""" + Path.GetFileName(att.RelPath) + @"""/>
";
            }

            string fileListTmpl = @"<xml xmlns:o=3D""urn:schemas-microsoft-com:office:office"">
 <o:MainFile HRef=3D""../Workbook.html""/>
{0}</xml>";

            fileList += string.Format(fileListTmpl, files);
            return(fileList);
        }
Ejemplo n.º 3
0
        public SingleFileAttachment AddAttachment(string path)
        {
            SingleFileAttachment sfa = new SingleFileAttachment(path);

            string ext = Path.GetExtension(path);

            if (!string.IsNullOrEmpty(ext))
            {
                ext = ext.ToLower();
            }

            sfa.RelPath = "Worksheets";
            this.Attachments.Add(sfa);
            return(sfa);
        }
Ejemplo n.º 4
0
        public SingleFileAttachment AddAttachment( string path )
        {
            SingleFileAttachment sfa = new SingleFileAttachment( path );

            string ext = Path.GetExtension( path );
            if( !string.IsNullOrEmpty( ext ) )
                ext = ext.ToLower();

            sfa.RelPath = "Worksheets";
            this.Attachments.Add( sfa );
            return sfa;
        }
Ejemplo n.º 5
0
        public string BuildIndex()
        {
            string tmp = Path.GetTempPath();
            SingleFileAttachment sfa = new SingleFileAttachment( tmp );
            sfa.Name = "Workbook.html";
            sfa.UseName = "Workbook.html";

            string index = this.BuildAttachmentHeader( sfa );
            index += Environment.NewLine;

            //string links = string.Empty;
            string sheets = string.Empty;
            foreach( SingleFileAttachment att in this.Attachments )
            {
                if( att.UseName.StartsWith( "Sheet" ) )
                {
                    //links += att.GetWorksheetLink();
                    sheets += att.GetWorksheetXML();
                }
            }

            index += string.Format( INDEX_TEMPLATE, sheets );
            index += Environment.NewLine;
            return index;
        }
Ejemplo n.º 6
0
        public string BuildFileList()
        {
            string tmp = Path.GetTempPath();
            SingleFileAttachment sfa = new SingleFileAttachment( tmp );
            sfa.Name = "filelist.xml";
            sfa.RelPath = "Worksheets";
            sfa.UseName = "filelist.xml";

            string fileList = this.BuildAttachmentHeader( sfa );
            fileList += Environment.NewLine;

            string files = string.Empty;
            foreach( SingleFileAttachment att in this.Attachments )
            {
                files += @" <o:File HRef=3D"""+ Path.GetFileName( att.RelPath ) +@"""/>
            ";
            }

            string fileListTmpl = @"<xml xmlns:o=3D""urn:schemas-microsoft-com:office:office"">
             <o:MainFile HRef=3D""../Workbook.html""/>
            {0}</xml>";

            fileList += string.Format( fileListTmpl, files );
            return fileList;
        }
Ejemplo n.º 7
0
 public string BuildAttachmentHeader( SingleFileAttachment att )
 {
     string header = att.GetAttachmentHeader( this.ContentLocationBase, this.MIMEBoundary );
     return header;
 }
Ejemplo n.º 8
0
        public string BuildAttachmentHeader(SingleFileAttachment att)
        {
            string header = att.GetAttachmentHeader(this.ContentLocationBase, this.MIMEBoundary);

            return(header);
        }