当前位置: 首页>>代码示例>>C#>>正文


C# Application.Save方法代码示例

本文整理汇总了C#中Application.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Application.Save方法的具体用法?C# Application.Save怎么用?C# Application.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Application的用法示例。


在下文中一共展示了Application.Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FetchApplication

        public static Application FetchApplication(string applicationName, string description)
        {
            // Load configuration data.
            string appName = GetConfigValue(applicationName, HostingEnvironment.ApplicationVirtualPath);
            Application app = Application.Fetch(QryFetchApplicationByName.Query(appName));

            if (app == null)
            {
                lock (fetchApplication)
                {
                    app = Application.Fetch(QryFetchApplicationByName.Query(appName));
                    if (app == null)
                    {
                        app = new Application()
                        {
                            ID = Guid.NewGuid(),
                            ApplicationName = appName,
                            Description = description,
                            LoweredApplicationName = appName.ToLower()
                        };
                        app.Save();
                        UnitOfWork.CurrentSession.Flush();
                    }
                }
            }

            return app;
        }
开发者ID:brendankowitz,项目名称:systembusinessobjects,代码行数:28,代码来源:ApplicationManager.cs

示例2: WriteToExcel

    public static Boolean WriteToExcel(GridView gridView)
    {
        try
        {
            if (gridView != null)
            {
                Application excel = new Application();
                Workbook book = excel.Workbooks.Add(true);
                Worksheet sheek = book.Worksheets[1] as Worksheet;
                sheek.Columns.ColumnWidth = 15;

                int rowIndex = 1;
                int colIndex = 1;

                for (int i = 0; i < gridView.HeaderRow.Cells.Count; i++)
                {
                    Range headRange = excel.Cells[1, colIndex] as Range;
                    headRange.Value = gridView.HeaderRow.Cells[i].Text.ToString();
                    headRange.HorizontalAlignment = XlHAlign.xlHAlignCenter;
                    headRange.Borders.LineStyle = XlLineStyle.xlContinuous;
                    headRange.Interior.Color = Color.Red;
                    colIndex++;
                }

                foreach (GridViewRow row in gridView.Rows)
                {
                    rowIndex++;
                    colIndex = 1;
                    for (int i = 0; i < row.Cells.Count; i++)
                    {
                        Range contentRange = excel.Cells[rowIndex, colIndex] as Range;
                        contentRange.Value = row.Cells[i].Text.ToString();
                        contentRange.HorizontalAlignment = XlHAlign.xlHAlignCenter;
                        contentRange.Borders.LineStyle = XlLineStyle.xlContinuous;
                        colIndex++;
                    }

                }

                excel.DisplayAlerts = false;
                excel.Save();
                excel.Quit();

                return true;
            }
            else
                return false;

        }
        catch (Exception)
        {
            return false;
        }
    }
开发者ID:smilelhh,项目名称:-web-,代码行数:54,代码来源:ExcelUtil.cs

示例3: Run

        public static void Run()
        {
            try
            {
                // ExStart:1
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

                DateTime start = DateTime.Now;
                Excel.Application excelApp = new Application();
                string myPath = dataDir + @"TempBook.xls";
                excelApp.Workbooks.Open(myPath, Missing.Value, Missing.Value,
                Missing.Value, Missing.Value,
                Missing.Value, Missing.Value,
                Missing.Value, Missing.Value,
                Missing.Value, Missing.Value,
                Missing.Value, Missing.Value,
                Missing.Value, Missing.Value);

                for (int i = 1; i <= 1000; i++)
                {
                    for (int j = 1; j <= 20; j++)
                    {
                        excelApp.Cells[i, j] = "Row " + i.ToString() + " " + "Col " + j.ToString();
                    }
                }

                excelApp.Save(dataDir + @"TempBook1_out.xls");
                excelApp.Quit();
                DateTime end = DateTime.Now;
                TimeSpan time = end - start;
                Console.WriteLine("File Created! " + "Time consumed (Seconds): " + time.TotalSeconds.ToString());
                // ExEnd:1
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
开发者ID:aspose-cells,项目名称:Aspose.Cells-for-.NET,代码行数:39,代码来源:VSTOCode.cs

示例4: CreateSandbox

        public static void CreateSandbox(TestContext testContext)
        {

            var site = new Site(Repository.Root);
            site.Name = "TestSiteForActionFramework";
                var urlList = new Dictionary<string, string>();
                urlList.Add("newtesthost", "Windows");
                site.UrlList = urlList;
                site.Save();
            

            //---- Appmodel
            //-------------

                //Root/TestRoot/(apps)
            var siteAppsFolder = new SystemFolder(site);
                siteAppsFolder.Name = "(apps)";
                siteAppsFolder.Save();
            
            //---- Folder
            //-----------

                // /TestRoot/(apps)/Folder
            var siteAppsFolderFolder = new SystemFolder(siteAppsFolder);
                siteAppsFolderFolder.Name = "Folder";
                siteAppsFolderFolder.Save();

                // /TestRoot/(apps)/Folder/App1
            var siteAppsApp1 = new Application(siteAppsFolderFolder);
                siteAppsApp1.Name = "App1";
                siteAppsApp1.Scenario = "sc1,sc4,sc5";
                siteAppsApp1.Save();

                // /TestRoot/(apps)/Folder/App2
            var siteAppsApp2 = new Application(siteAppsFolderFolder);
                siteAppsApp2.Name = "App2";
                siteAppsApp2.Scenario = "sc1,Settings";
                siteAppsApp2.Save();

                // TestRoot/(apps)/Folder/App3
            var siteAppsApp3 = new Application(siteAppsFolderFolder);
                siteAppsApp3.Name = "App3";
                siteAppsApp3.Scenario = "sc1,sc2,sc7,sc10";
                siteAppsApp3.RequiredPermissions = "5";
                siteAppsApp3.Save();

                // TestRoot/(apps)/Folder/App4
            var siteAppsApp4 = new Application(siteAppsFolderFolder);
                siteAppsApp4.Name = "App4";
                siteAppsApp4.Scenario = "sc2,sc6,sc10";
                siteAppsApp4.RequiredPermissions = "5";
                siteAppsApp4.Save();

                //Root/TestRoot/(apps)/Folder/App5
            var siteAppsApp5 = new Application(siteAppsFolderFolder);
                siteAppsApp5.Name = "App5";
                siteAppsApp5.Scenario = "sc11";
                siteAppsApp5.RequiredPermissions = "5;10;11";
                siteAppsApp5.Save();

                //Root/TestRoot/(apps)/Folder/App6
            var siteAppsApp6 = new Application(siteAppsFolderFolder);
                siteAppsApp6.Name = "App6";
                siteAppsApp6.Scenario = "sc12";
                siteAppsApp6.Save();

                //Root/TestRoot/(apps)/Folder/App12
            var siteSampleAppsApp12 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp12.Name = "App12";
                siteSampleAppsApp12.Scenario = "sc20";
                siteSampleAppsApp12.Save();

                //Root/TestRoot/(apps)/Folder/App21
            var siteSampleAppsApp21 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp21.Name = "App21";
                siteSampleAppsApp21.Scenario = "sc21";
                siteSampleAppsApp21.Save();

                //Root/TestRoot/(apps)/Folder/App22
            var siteSampleAppsApp22 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp22.Name = "App22";
                siteSampleAppsApp22.Scenario = "sc22";
                siteSampleAppsApp22.Save();

                //Root/TestRoot/(apps)/Folder/App23
                var siteSampleAppsApp23 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp23.Name = "App23";
                siteSampleAppsApp23.Scenario = "sc23";
                siteSampleAppsApp23.Disabled = true;
                siteSampleAppsApp23.Save();

                //Root/TestRoot/(apps)/Folder/App24
                var siteSampleAppsApp24 = new Application(siteAppsFolderFolder);
                siteSampleAppsApp24.Name = "App24";
                siteSampleAppsApp24.Scenario = "sc24";
                siteSampleAppsApp24.Disabled = true;
                siteSampleAppsApp24.Clear = true;
                siteSampleAppsApp24.Save();

                //Root/TestRoot/(apps)/Folder/App25
//.........这里部分代码省略.........
开发者ID:maxpavlov,项目名称:FlexNet,代码行数:101,代码来源:ActionTest.cs


注:本文中的Application.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。