|
| Iniciado por guest, 01,jun. 2015 09:07 - 4 respuestas |
| |
| | | |
|
| |
| Publicado el 01,junio 2015 - 09:07 |
Hi
As usual I am trying things way pass my skill set. I want to use Gembox Spreadsheet for spreadsheet creation on a web server and specifically Pivot Tables.
I have imported the .NET assembly and have managed the following 4 lines of code which does work although my data is imported into Sheet 1 and 'NewSheet' is never created.
ef is ExcelFile ef.Worksheets.Add("NewSheet") ef.LoadCsv("C:\My Sites\PlumAccounting\Exe\PlumAccounting_NOB97010\0\ActualvsBudget.csv",",") ef.save("C:\My Sites\PlumAccounting\Exe\PlumAccounting_NOB97010\0\Test.xlsx")
According to Gembox sample code something like this should be used to access a worksheet and data table:
C# ExcelWorksheet ws = ef.Worksheets.Add("NewSheet"); DataTable dt = new DataTable();
The problem is to reference ExcelWorksheet, or in fact any of the other methods in the .NET assembly besides ExcelFile.
I have tried this
ew is ExcelWorksheetCollection = ef.Worksheets.Add("NewSheet") ew is ExcelWorksheet = ef.Worksheets[1]
which does not work.
The error I get is Wrong parameter for constructor of ExcelWorksheet class.
Can anybody please shed some light on this?
Thanks in advance
Ericus Steyn |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,junio 2015 - 14:12 |
Hi Ericus,
I have been working with the gembox document assembly, not the spreadsheet on (for now), but I'l give it a try
First, it seems to me that your code is missing the first line, the licence one that should precede everything else
after that, here is a small example on how to call things on the document side, it should be the same (with different names, of course) on the spreadsheet one)
ComponentInfo.SetLicense("FREE-LIMITED-KEY") //load document oDocument is DocumentModel() oDocument <- DocumentModel.Load(CompleteDir(fExeDir())+"doc1.doc") //save as pdf oDocument.Save(CompleteDir(fExeDir())+"doc1.pdf") Hope this helps
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,junio 2015 - 15:24 |
Hi Fabrice
This code is working - sort of. It opens an existing spreadsheet and imports the CSV file which is a good start. But it does not add a new worksheet and if it did the data should have been imported into the second sheet as that automatically becomes the Active sheet.
SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY") ef is "GemBox.Spreadsheet.ExcelFile" ef <- ExcelFile.Load("C:\My Sites\PlumAccounting\Exe\PlumAccounting_NOB97010\0\Test.xlsx") ew is ExcelWorksheet <- ef.Worksheets.Add("Sheet2") ef.LoadCsv("C:\My Sites\PlumAccounting\Exe\PlumAccounting_NOB97010\0\ActualvsBudget.csv",",") ef.save("C:\My Sites\PlumAccounting\Exe\PlumAccounting_NOB97010\0\Test.xlsx")
So it's nearly there. I will place updates here if I progress more.
Regards
Ericus Steyn |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,junio 2015 - 16:35 |
Hi Ericus,
well, consideriung that yo are adding a second sheet into EW, while everything else is done on EF, and considering that you do not describe ANY relationship between the two objects, I do not see how it could possibly do what you want it to do
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,junio 2015 - 18:36 |
Yes Fabrice and if I knew how to do all that there would have been no need to post the message in the first place.
Regards
Ericus Steyn |
| |
| |
| | | |
|
| | | | |
| | |
|