Automate inserting OLE into Autocad drawings using web based programming language - c#

I am trying to insert and Excel object into and Autocad file (DWG), I need to do this by running some sort of script that will open the DWG file, import he Excel Sheet and then save the DWG file.
I need to do this using a web based programming language eg PHP, C#, Python etc.
If anyone could please point me in the right direction or even confirm that this can be done that would be a great help.

Similar question here:
https://stackoverflow.com/a/23471957/474702
It is not advisable to run instances of applications that expect direct user interaction from web based software, particularly if you expect the AutoCAD interop to be hosted on the server.
You may have to use a windows form or WPF application to work with AutoCAD. With this option, you can use C# or visual basic.Net. I have worked extensively with the AutoCAD interop for creating drawings, complete with BOMs.
AutoCAD.Application interop may not allow for non-visual interaction.

Related

How to create a windows application that will read/edit different excel files?

My goal is to create a simple (one file) executable for windows environment that will open a pretty simple form.
The form will read data from excel files and after the user fills out the form and submit it - the application will write the data to a different excel file.
This will be used by different users in a shared drive.
I have programming experience with C/C++/C#/.Net/Python and other languages but never really created a windows program.
Any ideas where should i start? (a relevant tutorial would be greatly appreciated)
Thanks!
To read and edit Excel files look into the Microsoft Office Interop libraries: class library documentation is available here. Regarding tutorials, the best approach would be to search the web and see what you can find. A couple I found are:
C# Excel Interop: http://www.dotnetperls.com/excel
How to automate Microsoft Excel from Microsoft Visual C#.NET: http://support.microsoft.com/kb/302084
Good luck! :)
OK. There are multiple ways.
You can make use of a RichTextBox and write it down to a excel file using Stream or even static methods that come with File class (only if you are dealing with lesser data and not worry much about performance).
If you are supposed to take care of formatting as well, take a look at Interop.

Office 2013 Web Apps - Standalone redistributable document

Please consider a case as show in the image below...
I have two different apps (content + navigation) in a same excel sheet that are able to communicate with each other,
Based on this scenario, following are some questions...
1- Is it possible to deliver an excel document (standalone) which contains both of these apps, so that the end user doesn't need to insert these apps from the ribbon toolbar and user could be able to use this document on any machine (without any configurations and involving the app store/network)?
2- Is it possible to automate the process of generating excel documents that contains both of these apps? My purpose of doing this automation is to change the data contained in excel sheets, and user can perform analysis with his data.
Thanks!
Asif
I asked the same question on msdn forums and got some feedback by them, you may follow the link below for details...
http://social.msdn.microsoft.com/Forums/office/en-US/057723f1-cfe5-4f41-9d7a-430cb2f0c4c6/create-a-distributable-excel-document-with-web-apps?forum=appsforoffice&prof=required
Based on these details, my understanding is that Office 2013 web apps don't currently support standalone deployments packaged with local html files. But in future they might think of providing support for disconnected mode web apps in Office 2013.
Your comments are welcome!
Thanks,
Asif

Create Autocad file with C#

I am expoloring currently an AutoCAD .NET API to create a dwg files from winform.
Is this possible or should I look for another library?
Are there any new tutorials of doing so?
thanks
Thanks for all your answers .... I will stick with my old DXF implementation, since this is personal project.
Here you have exacly how to do it. AutoCad includes an API for doing that. The problem is that you need to have AutoCad in the computer where your application remains.
I think your only choice if you want DWG is to use OpenDesign. If you don't want to pay what that costs, you can write DXF instead. I have used VectorDraw, which does give a reasonable object model, and can export DXF without any extra component (I think), or use OpenDesign to write DWG.
Autodesk sell a library called RealDWG which allow you to read and write dwg file with C# without AutoCAD installed. ~ 2500 € / year.
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=770257
You can also use DXF, which is easier to read and write (text file). The reference can be found here : http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853
As mentioned by others, OpenDesign is one possibility. It is, however, prohibitively expensive for small companies; we have started using CadLib, which is far cheaper and seems to do the trick so far. It writes to DXF or DWG, and has fairly good documentation.
If you're planning to create the file without having autocad running, then you CANNOT use the .net API. The use of the .net API basically requires AutoCAD (or the CoreConsole) to be running for it to work. (You can open other databases but you'd be doing it in process from Autocad.
If you don't want it running in process you can use the Interop API.
Or the other alternative is to is to write to a DXF format which can then be imported into AutoCAD (or any other CAD program) which is capable of reading the format.

Is there a pre-existing sulution using c# with the Excel Interops to template excel like jXLS does?

I'm looking for comments, alternative solutions and recommendations.
Background:
We currently have a CRUD app built on Websphere using the struts framework. We generate excel documents using a standalone C# application that is tied together to the web application using an ActiveX control. We pass XML that contains elements for each document. Under each document we have placeholders that contain a name and a value. The document generation application takes the name (either a cell reference or a named range) and a copy of the template from a file server. It then adds the data to all of the specified locations in the document and saves the document to the users "My Documents" folder. It then attempts to upload the documents to Documentum.
Current Problem:
One of the templates has grown to very large sizes. For the most part this is because of the amount of data that needs to be displayed. We breakdown the information into groupings. Each of these groupings needs to be able to display information for up to 20 pieces. Some of these tabs also need to display up to 100 sub elements for the pieces. Due to the current nature of the home built document generation framework, it's not possible to dynamically generate the different sections with a variable number of elements. This has recently started to cause problems with the maintenance of the template. If we need to make formatting changes, it needs to be replicated to not only every tab, but possibly for every instance within each tab.
I started to look at jXLS and it's templating abilities, but since it's java based it will be a hassle to integrate it with the c# application. The other alternatives would be to build jXLS like capabilities into our generation framework, integrate a third party library into the framework, or do the document generation on the Application server. I'd prefer to avoid reinventing the wheel, and would like to re use a library from somewhere.
I'd also like to not impact the existing work flow as much as possible. So the prefered order of solutions right now looks something like this.
1) use an Existing Library for .NET
2) Call the jXLS library from the DocumentGeneration framework.
3) Build in the templating capabilities to the Generation Framework
4) Use jXLS on the application server (Due to the way we have the process upload to Documentum)
What recommendations do you have for this?
I am not sure how much this will help you, but I have used NPOI in the past for generating XLS documents and it is quite easy to work with. NPOI is a .NET port of the Java POI, POI is used by jXLS internally.
I am not sure if it's functionality will suite your requirements, or at least be a starting point.
I've used Syncfusion's XLSIO component for excel templating along the lines of JXLS. It's .net and works pretty well, but it is a commercial product and licensing becomes expensive if you have lots of developers on the project.
If you find an open source port of JXLS do share!

Using C# to display powerpoint

Is there any good way to use a windows application written in C# to display/control a powerpoint slideshow? Ultimately I would like to show thumbnails in a form and clicking these thumbnails would advance the slides shown on a second monitor (similar to using Powerpoint itself to show a slideshow on a second monitor).
I would like to be able to use Powerpoint Viewer if Powerpoint is not installed.
There seems to be some ActiveX-controls that allows integration of Powerpoint in a form, but most of these seem to cost money, does anyone have experience using one of these controls?
Edit: I know that there is an object model accessable by adding a reference to Microsoft.Office.InterOp.Powerpoint, but I want to be able to distribute the resulting program without having Microsoft Office as a prerequisite, that was why I mentioned Powerpoint Viewer because it can be distributed freely.
This kb lays out the basics for working with the powerpoint presentation viewer object model. I'd suggest you include the viewer when you distribute your application.
http://support.microsoft.com/kb/265385
Once you get a reference to the viewer (top level) object it is basically the same as working with the powerpoint.presentation object model, but with less functionality (i.e. editing, etc)
If you are working with Powerpoint 2007, then you can add editing functionality by using the System.XML and related namespaces to work with the presentation file as an open xml file.
Regarding the comments about UNO/openoffice.org, I think these miss the point, as you cannot use UNO for working with powerpoint, it is for openoffice and that was not the origianl requirement of the questioner.
there are 3rd party toolsets like aspose, but then your goal was to work with the powerpoint viewer component (free) so I'm guessing you want to avoid paying for dev tools? Either way viewer components OM is perfectly suitable for displaying and previewing and existing slide show. (you will need one copy of Powerpoint so that you can author the presentation from scratch, plus Visual Studio to create the VSTO project).
One of our softwares here at work does that. Initially we used MS Office but recently we switched to use OpenOffice.org Uno since it offers better control than MS Office and is easier to work with. It has .NET CLI-bindings.
To answer your question, yes it can be done but our engineers would recommend you use OpenOffice.org instead.
Just like with Microsoft Excel and Word, Powerpoint has an Object Model that you can access in code by including a reference in your project to:
Microsoft.Office.InterOp.Powerpoint.
I've used the Excel and Word models, but haven't used the one for Powerpoint. You can get a little taste of what's available by opening up the Object Browser once you've included the reference to see what kind of functionality is available. This might be a viable solution for you if you don't want to use a 3rd party tool to access the object model.
I have used the Word toolkit from Aspose -- they have a Powerpoint toolkit too that I think would be worth looking at.
http://www.aspose.com/categories/file-format-components/aspose.slides-for-.net-and-java/default.aspx

Categories