Dilip Jangid

Dilip Jangid

  • NA
  • 2
  • 2.9k

sir please send me code to create excel sheet in(C#, Xaml)

Feb 25 2016 12:18 AM
i created code for above by using Visual studio13 bt there is an error
here is C# code :-
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;
using Windows.UI.Popups;
using Syncfusion.XlsIO;
using System.Collections;
using System.ComponentModel.DataAnnotations.Schema;
using Windows.Storage.Pickers;
using Windows.Storage;
using System.ComponentModel;
using ExcelLibrary.SpreadSheet;
using ExcelLibrary.CompoundDocumentFormat;
//using System.Windows.Forms.ComponentModel.Com2Interop;
//using System.Windows.Forms.Control;
//using System.Windows.Input;
namespace CreateExcel.View
{
class ExcelSheet
{
public async void createExcelSheet()
{
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
FileSavePicker savePicker = new FileSavePicker();
savePicker.SuggestedStartLocation = PickerLocationId.Desktop;
savePicker.SuggestedFileName = "CreateSpreadsheet";
savePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xlsx" });
StorageFile storageFile = await savePicker.PickSaveFileAsync();
// Saves changes to the specified storage file.
//await workbook.SaveAs(StorageFolder");
workbook.Close();
excelEngine.Dispose();
}
}
}
 and Here is Xaml Code:-
 
<Page
x:Class="CreateExcel.View.Trigger"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CreateExcel.View"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<StackPanel>
<Button Width="70" Height="40" HorizontalAlignment="Center" Content="Click" FontSize="15" Click="createExcel"></Button>
<TextBox Width="500" Height="40" FontSize="15" ></TextBox>
</StackPanel>
</Grid>
</Grid>
</Page>
and im getting an error i.e.
 
Microsoft.Windows.UI.Xaml.Common.targets(286,5): Xaml Internal Error error WMC9999: Cannot find type System.ComponentModel.LicenseProvider in module System.dll. 
 
 what is this :-"System.ComponentModel.LicenseProvider in module System.dll."
my email id -: "[email protected]
please send me solution  

Answers (3)