SilverLight DataGrid: Copy & paste - c#

Is there a way that I can select a bunch of rows or cells from a SilverLight DataGrid and Copy them for pasting into e.g. excel?
The DataGrid doesn't seem to have this functionality built in!
Thanks a lot

Silverlight 4 is great, Ctrl-A a datagrid, copy and paste it into Excel.
You can even customize what gets copied using ClipboardContentBinding, which is quite useful if you are using a TemplateColumn.

I would check out this link - seems fairly useful
http://weblogs.asp.net/manishdalal/archive/2008/11/12/cross-browser-copy-and-paste-in-datagrid-with-excel-support-part-1.aspx

Silverlight uses a vector rendering system. The text is not the same as text in Notepad- it's being rendered as a vector image. You can't highlight text in Silverlight or Flash.
If you're writing the app, offer a "download Excel file" button that redirects to an Excel file generator.

Are you looking to do this programmatically? If so, then you are out of luck with Silverlight 3. Silverlight 4 is supposed to add this functionality.

Related

How to generate excel like report in WPF?

I have this Excel Sheet That I want to generate from my WPF Application, What is the easiest way to do so, bear in mind that the table in the sheet may have many containers and each container may have one or more sizes and so on as shown.
I'v looked at the ReportViewer provided in WPF but I don't know how to design such a report using the ReportViewer.
Another thing came to my mind is to fill the excel sheet from the WPF and I found a way to do so by specifying tags (Ex: Date: ) in which I can fill these tags from my WPF application, but I don't know who to generate tables and set their columns and rows according to the data in the database.
Thank you.
Did you try adding Microsoft.Office.Interop.Excel as a dll, and try the code given here.
Or have a look at this sample:
WPF Spreadsheet
I have made good experience with the EPPlus library. The nice thing is, you don't need any MS Office components on your OS to generate the excel files.

Display Excel Spreadsheet in WinForms, C#

I have been struggling the last few hours trying to get an excel spreadsheet/workbook to be displayed on a Windows form using Visual Studio 2012, C#. I can retrieve the data from the workbook and display it on the form, but I need the functionality of Excel in the application, including stuff like Filtering, Conditional Formatting, Formulas, etc.
I have read up quite a lot, and as I understand it, there are no controls in Visual Studio to embed these (Office) files due to licencing, which makes sense. I have found a solution though, to display the file in a WebControl (I am sure I will be able to work with this), but when I try to load the excel file in the web control, it prompts the user to either open or save the file, and when 'Open File' is chosen, the file is opened using Microsoft Excel.
As I understand it, this happens because the ContentType (Mime type, Excel ContentType) of the file needs to be set in the browser (I need to do more research on this as I am not yet familiar with this concept, ).
The resources I am using:
Logic to save the contents to an Excel File: EPPlus
I was working from the following project, among others: Winforms Excel Example
The latter is almost exactly what I want to achieve, but keeps on asking to save or open the file, rather than just displaying it in the WebControl
Any help on this matter would be greatly appreciated.
There're commercial WinForms libraries from DevExpress, Syncfusion and Infragistics. I'm using DevExpress. I'd suggest their WinForms Spreadsheet control inspired by Excel. They also have Spreadsheet File API for .NET and Spreadsheet UI controls for ASP.NET, MVC, WPF, ASP.NET Core and Bootstrap.
You can try their free 30-day trial and see if DevExpress UI controls suit your needs.
Use DataGridView and program a functionnality if it doesn't have it!
OR
Use Excel COM to create an instance of Excel.

How does one create a PDF from a Usercontrol in WPF MVVM

I am creating a WPF application. I use MS Visual Studio 2010, C# and MVVM.
On a usercontrol, I have a gridview. That gridview is populated with data from another class, via binding and itemsourceing etc... No problems there. I see the data and everything. I also have a few labels and textboxes around the usercontrol. These will be used by the user to fill in random data. Stuff like name, address and the such. You could call it an order form. The list of products in the gridview with the details provided below.
Once the user clicks OK, the application should now create a PDF of the entire usercontrol. How do I do that?
I can export a gridview to Excel just fine. But now I want to basically recreate the usercontrol into a PDF file.
I have read online that I can create an image of the usercontrol and convert that image to PDF. Would that help? I know from screenshots that the textboxes still have the borders around them and such.
But for now, how do I create a PDF from the usercontrol, using the MVVM approach?
And a side question. If I can use a save to dialog box, where the user can select where to save the file, can I get that location in a string to use it to open the PDF document in a report viewer on a seperate usercontrol?
If there is a need for coding, images or anything else, please comment and I'll edit the question with the changes.
Generating a PDF from a UserControl is non-trivial in C#. I'd strongly recommend finding a 3rd party tool to create your report design and to use that to export to PDF.
If you decide not to stand on the shoulders of giants and want to roll your own, then you'll need to implement the following
Create a separate control that can use your ViewModel as it's DataContext but which has the controls coloured and shaded for printing
Export the control to XPS using the System.Windows.Xps namespace libraries.
Convert the XPS to PDF using a 3rd party tool.
It's a pain, I know, but I can't see a simpler route for you.

Mimic Excel Text Import wizard in Winforms

I have a requirement to paste the clipboard data to a textbox and split the data into columns as what we can do in Excel Text Import wizard.
Can anybody suggest me a starting point to get hold of this?
an idea can be put each character of first line of the text in many TextBox control which created and arranged horizontally in a windows form so an user can separate line by clicking on each text box to show the breaking points
I've found some old CPP code for a control here:
http://www.codeproject.com/KB/miscctrl/separator_ctrl.aspx
I'm still trying to find an updated version for .NET. (I'm not sure I have the time to try to convert this, myself.)

import c# winforms into excel,

Please show me the code how to import winforms controls, into excel xls. file.
I have created one winform in c#, but while taking print out c#,
there s no table border lines, because in c# winforms onle table layout tools s present, so i need to import this to excel and convert to table format and take print out.
thank u.... i expect the answer from your side...
I honestly don't really know what you're asking, but I'm going to take a guess that you want to host WinForms controls in an Excel workbook?
If so, you may find these MSDN articles useful:
How to: Add Windows Forms Controls to Office Documents
Using Windows Forms Controls on Excel Worksheets
Otherwise, you'll need to clarify your question and ask something a little more specific.

Categories

Resources