public async void ViewFormattedDocument(object parameter)
        {
            IWorkbookFormatProvider provider = new XlsxFormatProvider();
            Workbook workbook;

            try
            {
                Assembly assembly = typeof(ConditionalFormattingViewModel).Assembly;
                string   fileName = assembly.GetManifestResourceNames().First(n => n.Contains("SpreadProcessingDocument2.xlsx"));

                using (Stream stream = assembly.GetManifestResourceStream(fileName))
                {
                    workbook = provider.Import(stream);
                }
                this.AddRules(workbook);

                Stream mystream = await OpenStreamAsync(workbook);

                using (mystream)
                {
                    IFileViewerService fileViewerService = DependencyService.Get <IFileViewerService>();
                    await fileViewerService.View(mystream, fileName);
                }
            }
            catch
            {
                IMessageService messageService = DependencyService.Get <IMessageService>();
                await messageService.ShowMessage("An error occured", "An error occured, please try again.");
            }
        }
Ejemplo n.º 2
0
        private static async Task ViewDocumentAsync(Workbook workbook, string fileName)
        {
            Stream stream = await OpenStreamAsync(workbook);

            using (stream)
            {
                IFileViewerService fileViewerService = DependencyService.Get <IFileViewerService>();
                await fileViewerService.View(stream, fileName);
            }
        }
Ejemplo n.º 3
0
        private async Task GenerateAsync()
        {
            try
            {
                Workbook workbook = this.CreateWorkbook();
                Stream   stream   = await OpenStreamAsync(workbook);

                using (stream)
                {
                    string             fileName          = string.Format("RadSpreadProcessingFile.xlsx");
                    IFileViewerService fileViewerService = DependencyService.Get <IFileViewerService>();
                    await fileViewerService.View(stream, fileName);
                }
            }
            catch
            {
                IMessageService messageService = DependencyService.Get <IMessageService>();
                await messageService.ShowMessage("An error occured", "An error occured, please try again.");
            }
        }
Ejemplo n.º 4
0
        private async static Task GenerateAsync(string exportFormat)
        {
            try
            {
                Workbook workbook = workbookCache ?? await ImportAndCacheWorkbookAsync();

                Stream stream = await OpenStreamAsync(workbook, exportFormat);

                using (stream)
                {
                    string             fileName          = string.Format("RadSpreadProcessingConvertedFile.{0}", exportFormat);
                    IFileViewerService fileViewerService = DependencyService.Get <IFileViewerService>();
                    await fileViewerService.View(stream, fileName);
                }
            }
            catch
            {
                IMessageService messageService = DependencyService.Get <IMessageService>();
                await messageService.ShowMessage("An error occured", "An error occured, please try again.");
            }
        }