コード例 #1
0
        private static void AddExcelDocument(string[] attributes)
        {
            var document = new ExcelDocument();

            SetDocumentProperties(document, attributes);
            AddDocument(document);
        }
コード例 #2
0
 private static void AddExcelDocument(string[] attributes)
 {
     ExcelDocument doc = new ExcelDocument();
     AddDocument(attributes, doc);
 }
コード例 #3
0
        private static void AddExcelDocument(string[] attributes)
        {
            ExcelDocument doc = new ExcelDocument();

            AddDocument(attributes, doc);
        }
コード例 #4
0
 public string AddExcelDocument(string[] attributes)
 {
     var document = new ExcelDocument();
     return this.AddDocument(document, attributes);     
 }              
コード例 #5
0
ファイル: All.cs プロジェクト: paveldk/Telerik
        private static void AddExcelDocument(string[] attributes)
        {
            string temp    = null;
            string name    = null;
            string content = null;
            int?   rows    = null;
            int?   cols    = null;
            ulong? size    = null;
            string version = string.Empty;
            int    index;

            for (int i = 0; i < attributes.Length; i++)
            {
                if (attributes[i].Contains("name"))
                {
                    name  = attributes[i];
                    index = name.IndexOf('=');
                    name  = name.Substring(index + 1);
                }

                if (attributes[i].Contains("rows"))
                {
                    temp  = attributes[i];
                    index = temp.IndexOf('=');
                    rows  = Convert.ToInt32(temp.Substring(index + 1));
                }

                if (attributes[i].Contains("cols"))
                {
                    temp  = attributes[i];
                    index = temp.IndexOf('=');
                    cols  = Convert.ToInt32(temp.Substring(index + 1));
                }

                if (attributes[i].Contains("content"))
                {
                    content = attributes[i];
                    index   = content.IndexOf('=');
                    content = content.Substring(index + 1);
                }

                if (attributes[i].Contains("size"))
                {
                    temp  = attributes[i];
                    index = temp.IndexOf('=');
                    size  = (ulong)Convert.ToInt64(temp.Substring(index + 1));
                }

                if (attributes[i].Contains("version"))
                {
                    version = attributes[i];
                    index   = version.IndexOf('=');
                    version = version.Substring(index + 1);
                }
            }

            if (name != null)
            {
                var excelDoc = new ExcelDocument(name, content, size, version, rows, cols);
                Console.WriteLine("Document added: {0}", name);
                documents.Add(excelDoc);
            }
            else
            {
                Console.WriteLine("Document has no name");
            }
        }
コード例 #6
0
        public string AddExcelDocument(string[] attributes)
        {
            var document = new ExcelDocument();

            return(this.AddDocument(document, attributes));
        }
コード例 #7
0
        private static void ListDocuments()
        {
            //
            if (documents.Count == 0)
            {
                Console.WriteLine("No documents found");
            }
            foreach (var item in documents)
            {
                if (item is IEncryptable)
                {
                    IEncryptable obj = item as IEncryptable;
                    if (obj.IsEncrypted == true)
                    {
                        Console.WriteLine("{0}[encrypted]", obj.GetType().Name);
                        continue;
                    }
                }

                Type          type = item.GetType();
                StringBuilder sb   = new StringBuilder();
                sb.Append(type.Name + "[");
                if (type.Name == "TextDocument")
                {
                    TextDocument doc = item as TextDocument;
                    if (doc.Charset != null)
                    {
                        sb.AppendFormat("charset={0};", doc.Charset);
                    }
                    if (doc.Content != null)
                    {
                        sb.AppendFormat("content={0};", doc.Content);
                    }
                    sb.AppendFormat("name={0}", doc.Name);
                }
                else if (type.Name == "PDFDocument")
                {
                    PDFDocument doc = item as PDFDocument;
                    if (doc.Content != null)
                    {
                        sb.AppendFormat("content={0};", doc.Content);
                    }
                    sb.AppendFormat("name={0}", doc.Name);
                    if (doc.Pages != null)
                    {
                        sb.AppendFormat(";pages={0}", doc.Pages);
                    }
                    if (doc.Size != null)
                    {
                        sb.AppendFormat(";size={0}", doc.Size);
                    }
                }
                else if (type.Name == "WordDocument")
                {
                    WordDocument doc = item as WordDocument;
                    if (doc.Chars != null)
                    {
                        sb.AppendFormat("chars={0};", doc.Chars);
                    }
                    if (doc.Content != null)
                    {
                        sb.AppendFormat("content={0};", doc.Content);
                    }
                    sb.AppendFormat("name={0}", doc.Name);
                    if (doc.Size != null)
                    {
                        sb.AppendFormat(";size={0}", doc.Size);
                    }
                    if (doc.Version != null)
                    {
                        sb.AppendFormat(";version={0}", doc.Version);
                    }
                }
                else if (type.Name == "ExcelDocument")
                {
                    ExcelDocument doc = item as ExcelDocument;
                    if (doc.Cols != null)
                    {
                        sb.AppendFormat("cols={0};", doc.Cols);
                    }
                    if (doc.Content != null)
                    {
                        sb.AppendFormat("content={0};", doc.Content);
                    }
                    sb.AppendFormat("name={0}", doc.Name);
                    if (doc.Rows != null)
                    {
                        sb.AppendFormat(";rows={0}", doc.Rows);
                    }
                    if (doc.Size != null)
                    {
                        sb.AppendFormat(";size={0}", doc.Size);
                    }
                    if (doc.Version != null)
                    {
                        sb.AppendFormat(";version={0}", doc.Version);
                    }
                }
                else if (type.Name == "AudioDocument")
                {
                    AudioDocument doc = item as AudioDocument;
                    if (doc.Content != null)
                    {
                        sb.AppendFormat("content={0};", doc.Content);
                    }
                    if (doc.Length != null)
                    {
                        sb.AppendFormat("length={0};", doc.Length);
                    }
                    sb.AppendFormat("name={0}", doc.Name);
                    if (doc.Samplerate != null)
                    {
                        sb.AppendFormat(";samplerate={0}", doc.Samplerate);
                    }
                    if (doc.Size != null)
                    {
                        sb.AppendFormat(";size={0}", doc.Size);
                    }
                }
                else if (type.Name == "VideoDocument")
                {
                    VideoDocument doc = item as VideoDocument;
                    if (doc.Content != null)
                    {
                        sb.AppendFormat("content={0};", doc.Content);
                    }
                    if (doc.Framerate != null)
                    {
                        sb.AppendFormat("framerate={0};", doc.Framerate);
                    }
                    sb.AppendFormat("name={0}", doc.Name);
                    if (doc.Length != null)
                    {
                        sb.AppendFormat(";length={0}", doc.Length);
                    }
                    if (doc.Size != null)
                    {
                        sb.AppendFormat(";size={0}", doc.Size);
                    }
                }
                sb.Append("]");
                Console.WriteLine(sb.ToString());
            }
        }