예제 #1
0
        // Exports an IEntityCollection to a table in given Document. BookmarkName is the name of the bookmark associated
        // with the table.
        public static dynamic ExportEntityCollection(string DocumentPath, string BookmarkName, int StartRow, bool BuildColumnHeadings, IEntityCollection collection, List <string> ColumnNames)
        {
            dynamic functionReturnValue   = null;
            List <ColumnMapping> mappings = new List <ColumnMapping>();
            ColumnMapping        map      = default(ColumnMapping);

            dynamic    doc       = null;
            WordHelper wordProxy = new WordHelper();

            // if Word is active then use it
            if (!wordProxy.GetWord())
            {
                if (!wordProxy.CreateWord())
                {
                    throw new System.Exception("Could not start Microsoft Word.");
                }
            }

            wordProxy.OpenDocument(DocumentPath);
            doc = wordProxy.Document;

            foreach (string name in ColumnNames)
            {
                map = new ColumnMapping("", name);
                map.TableField.DisplayName = name;
                mappings.Add(map);
            }

            functionReturnValue = ExportEntityCollection(doc, BookmarkName, StartRow, BuildColumnHeadings, collection, mappings);
            wordProxy.ShowDocument();
            return(functionReturnValue);
        }
예제 #2
0
        public static dynamic GenerateDocument(string Template, IEntityObject Item, List <ColumnMapping> ColumnMappings)
        {
            dynamic    doc       = null;
            WordHelper wordProxy = new WordHelper();

            wordProxy.CreateWord();
            wordProxy.OpenDocument(Template);
            PopulateContentControls(ColumnMappings, Item, wordProxy);
            doc = wordProxy.Document;
            wordProxy.ShowDocument();

            return(doc);
        }
예제 #3
0
        // Exports an IEntityCollection to a table in given Document. BookmarkName is the name of the bookmark associated
        // with the table.
        public static dynamic ExportEntityCollection(string DocumentPath, string BookmarkName, int StartRow, bool BuildColumnHeadings, IEntityCollection collection, List <ColumnMapping> ColumnNames)
        {
            dynamic    functionReturnValue = null;
            dynamic    doc       = null;
            WordHelper wordProxy = new WordHelper();

            // if Word is active then use it
            if (!wordProxy.GetWord())
            {
                if (!wordProxy.CreateWord())
                {
                    throw new System.Exception("Could not start Microsoft Word.");
                }
            }

            wordProxy.OpenDocument(DocumentPath);
            doc = wordProxy.Document;

            functionReturnValue = ExportEntityCollection(doc, BookmarkName, StartRow, BuildColumnHeadings, collection, ColumnNames);
            wordProxy.ShowDocument();
            return(functionReturnValue);
        }
예제 #4
0
        public static dynamic GenerateDocument(string Template, IEntityObject Item, List<ColumnMapping> ColumnMappings)
        {
            dynamic doc = null;
            WordHelper wordProxy = new WordHelper();

            wordProxy.CreateWord();
            wordProxy.OpenDocument(Template);
            PopulateContentControls(ColumnMappings, Item, wordProxy);
            doc = wordProxy.Document;
            wordProxy.ShowDocument();

            return doc;
        }
예제 #5
0
        // Exports an IEntityCollection to a table in given Document. BookmarkName is the name of the bookmark associated
        // with the table.
        public static dynamic ExportEntityCollection(string DocumentPath, string BookmarkName, int StartRow, bool BuildColumnHeadings, IEntityCollection collection, List<ColumnMapping> ColumnNames)
        {
            dynamic functionReturnValue = null;
            dynamic doc = null;
            WordHelper wordProxy = new WordHelper();

            // if Word is active then use it
            if (!wordProxy.GetWord())
            {
                if (!wordProxy.CreateWord())
                {
                    throw new System.Exception("Could not start Microsoft Word.");
                }
            }

            wordProxy.OpenDocument(DocumentPath);
            doc = wordProxy.Document;

            functionReturnValue = ExportEntityCollection(doc, BookmarkName, StartRow, BuildColumnHeadings, collection, ColumnNames);
            wordProxy.ShowDocument();
            return functionReturnValue;
        }
예제 #6
0
        // Exports an IEntityCollection to a table in given Document. BookmarkName is the name of the bookmark associated
        // with the table.
        public static dynamic ExportEntityCollection(string DocumentPath, string BookmarkName, int StartRow, bool BuildColumnHeadings, IEntityCollection collection, List<string> ColumnNames)
        {
            dynamic functionReturnValue = null;
            List<ColumnMapping> mappings = new List<ColumnMapping>();
            ColumnMapping map = default(ColumnMapping);

            dynamic doc = null;
            WordHelper wordProxy = new WordHelper();

            // if Word is active then use it
            if (!wordProxy.GetWord())
            {
                if (!wordProxy.CreateWord())
                {
                    throw new System.Exception("Could not start Microsoft Word.");
                }
            }

            wordProxy.OpenDocument(DocumentPath);
            doc = wordProxy.Document;

            foreach (string name in ColumnNames)
            {
                map = new ColumnMapping("", name);
                map.TableField.DisplayName = name;
                mappings.Add(map);
            }

            functionReturnValue = ExportEntityCollection(doc, BookmarkName, StartRow, BuildColumnHeadings, collection, mappings);
            wordProxy.ShowDocument();
            return functionReturnValue;
        }