コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #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;
        }
コード例 #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;
        }
コード例 #7
0
 public string BuildAttachmentHeader( SingleFileAttachment att )
 {
     string header = att.GetAttachmentHeader( this.ContentLocationBase, this.MIMEBoundary );
     return header;
 }
コード例 #8
0
        public string BuildAttachmentHeader(SingleFileAttachment att)
        {
            string header = att.GetAttachmentHeader(this.ContentLocationBase, this.MIMEBoundary);

            return(header);
        }