BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Dear Sir/Madam,
I'm trying to evaluate the usage of the XlsIO control for use in a windows 8 application.
I'm hoping to use the control as part of a Windows 8 Runtime component and have created a project with the correct references.
In my simple example, the control appears to create a file, but doesn't seem to write any contents, nor save the file correctly when I try.
My very simple example class is attached to the this post, would it be possible for someone to let me know what I may be doing incorrectly here? I've tried a few ways to write content to a file but I can't seem to get them to work.
At the moment the SaveAsAsync() function is returning false, which doesn't feel correct, and the file when created when I try to open it, tells me the extension isn't the same format as the extension, which seems like I've just created a blank file, rather than the XlsIO control creating the correct mime/content types etc.
Any pointers would be greatly appreciated.
Regards,
Doug
Hi Doug,
Thank you for using Syncfusion products.
As you have mentioned we could not find the attachment.
Could you please get back to us with the simplified sample attachment which help
us to investigate further on this. Also, we have attached the simple sample for
your reference. Could you please cross check your sample and our simple sample
code snippet which may helps you to resolve the issue, if still the issue
reproduces at your end then please get back to us with the missed attachment.
Please let us know if you need any clarification.
Regards,
Prasanth
Hi Prasanth,
I've re-attached the zip file and uploader on the forum says 'File Uploaded Successfully'.
Please let me know if this attached correctly, or perhaps if not, I could sent it directly, do you have a direct email I could fire the example too?
Kind Regards,
Doug
Additionally, if it's any help, here is my C# windows runtime component code:
using Syncfusion.XlsIO;
using System;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Storage;
namespace WindowsRuntimeComponent1
{
public sealed class TestSpreadsheet
{
public static IAsyncOperation<string> ButtonPress(StorageFile file)
{
var task = Task.Run<string>(async () => await SaveSpreadsheet(file));
return task.AsAsyncOperation();
}
public static IAsyncOperation<string> SaveSpreadsheet(StorageFile file)
{
var task = Task.Run<string>(async () =>
{
var engine = new ExcelEngine();
var app = engine.Excel;
var book = app.Workbooks.Create();
book.Version = ExcelVersion.Excel97to2003;
var sheet = book.Worksheets[0];
sheet.InsertRow(1, 1);
sheet.InsertColumn(1, 1);
sheet.Range["A1"].Text = "I'm some content!";
var res = await book.SaveAsAsync(file, ExcelSaveType.SaveAsXLS);
return res.ToString();
});
return task.AsAsyncOperation();
}
}
}
and here's my calling winjs code:
button.onclick = function () {
var filePicker = new Windows.Storage.Pickers.FileSavePicker;
filePicker.suggestedStartLocation = Windows.Storage.KnownFolders.documentsLibrary;
filePicker.suggestedFileName = "Superfile";
filePicker.fileTypeChoices.insert("Excel Files", [".xls"]);
filePicker.pickSaveFileAsync().then(function(file) {
WindowsRuntimeComponent1.TestSpreadsheet.buttonPress(file).then(function(res) {
document.getElementById('res').innerText = "Export should have: " + res;
});
});
};