import c# winforms into excel, - c#

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.

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.

Using a C# winform with Access to fill a template and convert it to PDF

Im working on adding an estimating feature to my business productivity software and was looking for some general ideas. I currently hand type the estimates into a template I made in an Open Office Document.
I would like the template to be filled in on submission of the form and then have the template converted to PDF. How could I best achieve this? The program is written in C# using Access. Basically, I'm looking for the most efficient way to do this. If I have to scrap my Open Office template for something else that is fine.
I will also need to be able to acess the fields and repopulate a form to modify the estimate if necessary.
Thanks in advance for pointing me in the right direction!

How to export data in Groupbox into PDF?

I have built a very simple windows form application using C#. But I am stuck here and could not find any help anywhere.
What my simple application does is that it queries out the information in the groupbox which has textboxes labels and buttons. I would like to export or convert the data from in the groupbox into the pdf.
Is there a way to implement that??
Thank you so much in advance~
You may want to have a look at http://www.pdfsharp.com/PDFsharp/. It's a pretty good framework for what you need.
Good luck
There are so many options, following SO Link provides the solution and it is working it seems
convert windows form to pdf file
Other Solution
Use following code to take screenshot
http://www.developerfusion.com/code/4630/capture-a-screen-shot/
Use PDFSharp to save as PDF
there's really a ton of different solutions for this, but you will almost absolutely need a 3rd party library for what you're trying to do. Google around for a pdf library for c#, as there are several.
EDIT: some possible solutions may be PDFjet, PDFsharp,ABCPDF (do note, if this is part of a commercial application, make sure that the licensing allows use for it)

Visualise map data in Excel

I have postcode level data in an Excel workbook and ideally I would like to have a map on another sheet of the area that I am interested in. The postcodes in my dataset should be highlighted within that map. I am using Excel 2010 and have no prior experience with GIS but plenty of experience with C#, Java. Any ideas of how I can achieve this? I looked for open source add-ins and didn't find an awful lot. Is there another way I can achieve what I want?
I use Topo.ly. You can just copy all your post codes from Excel and paste them in Topo.ly, and it will plot them on Google Maps. It also hosts your maps, so you can save it and come back to it later, or share it with others.
You can take a look to that solution for non-gis-users:
http://www.esri.com/software/esri-maps-for-office
It requires Office 2010 (that's no problem in your case) and it is based on a privative GIS software (no FLOSS). On the videos section there are some examples.
This can be a good starting point. You will need some knowledge of WPF
Bing Maps Windows Presentation Foundation (WPF) Control, Version 1.0
Then using VSTO you can integrate it into Excel
Using WPF Controls in Office Solutions
Sample WPF application is # Integrating Bing Maps With WPF
Edit :
Didnt find much on non WPF solution but you can give this a try
Integrating Virtual Earth Maps and Excel 2007 Using Visual Studio 2005 Tools for Office Second Edition
Download here http://archive.msdn.microsoft.com/VSTOVirtualEarthXL
For future reference or someone who has similar porblem, you can use an Excel add-in called Funfun to create data map in Excel 2016. I made two examples here.
As you could see, there is some code in the middle section of the screenshot. That is because Funfun allows you to write and run JavaScript code directly in Excel, also, the JavaScript code could use the data stored in the sheet. The capability of using JavaScript means that you could use 3rd party libraries like HighCharts.js or D3.js to plot charts like data map. In those two examples, I actually used highmaps which is part of the HighCharts.js library. The highmaps.js already has different templates from world map to specific map of different countries. I believe you could find the map you need.
Funfun also has an online editor in which you could test your JavaScript code with you data. You could check the detailed code of the examples above on the link below.
https://www.funfun.io/1/#/edit/5a5c9a50404f66229bda3ae0
https://www.funfun.io/1/#/edit/5925036104ce702ccfb22b0e
If you are satisfied with the result you achieved in the online editor, you could easily load the result into you Excel using the URL above. Of couse first you need to insert the Funfun add-in from Insert - My add-ins. Here are some screenshots showing how you could do this.
Disclosure: I'm a developer of Funfun

Categories

Resources