I'm using visual studio and I'd like to have a paper copy of my project. There are c# libraries, aspx files, javascript files, css... I'd like to print everything at once to my pdf printer. I know I can do this one file at a time but I was wondering if there is a magic button for that?
Thanks.
Having just looked for the same thing a couple weeks ago, there isn't a perfect solution that I could find... This question was asked before:
Visual Studio: Printing all source files in a solution?
With the answer pointing to an old macro from MSDN here:
http://msdn.microsoft.com/en-us/library/ms973240.aspx
Another search turned up a result for a commercial product that claims to do what you're looking for, however, I haven't tried it and was unable to even find pricing:
http://submain.com/products/prettycode.print.net.aspx
Hope that helps, in the end I just opened all the files at once and just closed each one as I printed it. Not at all ideal, but it got the job done at the time.
Related
My windows forms application uses Novacode DocX to write a document from a template. The Novacode portion of the project works perfect and the file saves. The issue is that when I load the document the field/s (Table Of Contents) are not updated when the Novacode portion adds headings and such.
I could, and did, write a macro to update fields on open. This would solve the problem, but not everyone that will use my application will have this macro. I can't save the file as a .docm file with the macro attached for various reasons (assume file must be ".docx").
What I've found is that the Microsoft.office.interop.Word assembly will allow me to call "Fields.Update". My understanding is this will do the trick, but I can't block users that don't have word installed from running my application. My understanding is that if I am "Using Microsoft.Office.Interop.Word", or have it in my references that the application won't run if someone doesn't have word.
So I have code that checks if word is installed. If I run this, and it is installed, can I then use "Late Binding" to run interop code? Other related questions, have replies that point to "NetOffice" as a way to run interop without checking if word is installed.
I'm trying to make this as comprehensive as possible with my research. My question is very similar to this one "
how do I easily test the case where my C# application can't find an external assembly?". I would hope this issue can soon be solved for everyone, but I'm not sure it will be.
Side note, if anyone knows a way to update the fields, or even just the existing TOC, of a word document that is saved in the ".docx" format without having word installed that would be awesome to know, and would circumvent my whole issue. Although I would still like to know the answer to the interop question.
Also this is my first real question on StackOverflow, if you have tags to suggest please do so along with your answer. If you have feedback on how I ask my question, I will accept that too, but please don't close/delete the question without any answers. I linked to questions that are similar, but those questions have not gotten responses in a while. I believe I have done everything according to the rules.
This is more of an answer to your "if anyone knows a way to update the fields, or even just the existing TOC, of a word document that is saved in the ".docx" format without having word installed" question, but you might want to look in to the Open XML SDK for Office.
This will let you modify .docx files without having any dependency on having Word installed.
I found this tutorial which I think is doing almost exactly what you are wanting do do using the Open XML SDK.
Many things to say, but I think I found my answers
The main question was if I add the reference to "Microsoft.Office.Interop.Word" and the client running the application does not have word, where will the application fail? My understanding now, is that it will not fail on launch if the client does not have word. It will, however, fail when the code that uses the "Office.Interop.Word" is reached.
The way to prevent this, is a simple registry check method. I used a variation of This method to check the registry. Then before any of my code that uses the "Office.Interop.Word" code is run, I check if the client has word in the registry. If they don't have word, I take the proper notification actions for my application. I also surrounded the "Office.Interop.Word" code in a "try catch" exception block as a double safe measure. In my code the exception would mean word is not installed. A variation of the code using "Office.Interop.Word" I used to update fields can be found here.
Novacode DocX can support Docm files if you change the code yourself. I did not want to, and didn't use a docm file. Docm files have security warnings associated to them when emailed. So an auto updating macro is out of the question.
-Octopus Emoji is Celebrating
Alright so this may be a total n00b question but I'm using the WatiN 2.1 library with Visual Studio 2013 and I'm trying to automate a mostly javascript-based webpage. I've done this task already using VBA but I wanted to redo it in C#. The webpage has multiple AND elements and some necessary fields are contained in lower levels of each. In VBA, I was able to navigate the page by simple doing something like this:
ie.Document.frames("frameID1").Document.frames("frameID2").Document.getElementByID("target").Click
This line of code would work whether frameID1 or frameID2 were frames or iframes. It didn't seem to matter to VBA. I tried a similar approach in C# using WatiN but it seems like the Frame feature in WatiN only recognizes as frame elements and simply recognizes a element as a simple HTML element.
That being said, I have read the question regarding this found here
but this is where my questoin arises. They say the solution is to alter the code for the AllFramesProcessor method and that fixes it. But how exactly do you access and modify this code? This code is contained in a .dll which I've tried to modify using .NET Reflector. I've export the source code, opened it in Visual Studio, found the code to modify and did so, but when I tried to build a new release, it threw multiple errors. Any suggestions on how to modify this block of code properly and get a version of WatiN that can handle elements?
I'm not really used to ask some questions. But it's gonna 4 days now, and I'm still stuck with this issue.
I would like to create a feature, using Visual Studio 2010, which allows me to upload and replace some files into a Sharepoint 2010 web site. Visual studio and C# are brand new for me, but with our good friend Google, I can handle it.
I can make a feature for changing the title of my website for example. But I don't really know how to do for uploading and replace some files (like a .css or a .js for example). I don't even know where to start and what I should looking for.
Do you guys have a clue to help me out?
Can you elaborate on what you exactly are trying to do? I can provide you with code to upload files within SharePoint, but if I see what files you are trying to upload I am wondering how you want to use them.
If you are trying to add css or js files to use them in your own webparts, you should add a mapped folder for "Layouts" and put those files in that folder. There are a lot of different possibilities with SharePoint, so maybe to start you should check out some hands on tutorials to create a feature, custom webparts, ... and a lot of your questions will be answered in those tutorials.
Good luck with it!
This is a follow up question from my previous one found here
I need to print a few pages each with images that need to be downloaded to be able to show them. But whenever I start up the .doc with the assignment to print trough my C# application, it only prints the text because the images have not fully loaded yet.
That's when I made the thread mentioned above to find a solution. A solution was given and it worked just fine until yesterday when they replaced the PC with a newer one. This PC still has the same Word 2007 installed and when I tried to apply the above solution; it did not work anymore. Same result as before and I have no idea why.
I also tried delaying the print parameter by 10 seconds to give word some time to load the images, this works, but 10 seconds might not be enough for larger documents, and what if the connection would time-out?
So I need a solid way of preventing word from printing until after the images have been (down)loaded into the document, either using C# or the build-in Word options. Please help.
Instead of using Process you should use word interop.
refer follwoing links
http://www.codeproject.com/KB/printing/WordPrinting.aspx
http://www.codeproject.com/KB/office/WordPrint.aspx
http://msdn.microsoft.com/en-us/library/b9f0ke7y.aspx
Alright first off, sorry for the extremely late answer, I just found out this was still open.
Apparently all versions of Word (at least from 2003) have the option to load external content before printing built in. This includes Word 2010, only in 2010 it appears as if Word is ignoring the feature. I tested this on 3 machines, I don't know why, but in 2010 it get's ignored.
Now I noticed while testing how if you open a word document that was already running in the background, it will just bring it to the front, which gave me an idea that led me to the solution.
Step 1: Open the document you need to print.
Step 2: According to the
number of external items to load, set up a timer (I gave the
application half a second per image to load, this is way more then
needed but better safe than sorry)
Step 3: Open the document again
but this time using the print parameter.
Now the document will only be re-shown to the front and begin to print the already open document.
I do NOT really recommend this solution to anyone, since it's more of a work-around then a reliable fix. But it get's the job done.
I am currently trying to develop a simple plugin for visual studio 2008 using c#.
I feel kind of stupid to ask, but after searching the doc for a few hours I can't find a way for a really simple task: Assume this open solution. I simply want a list of the documents open in the TABs on the right. I tried something, see below...
alt text http://img24.imageshack.us/img24/5238/20091201172237.png
This approach is not working:
alt text http://img339.imageshack.us/img339/6571/20091201172211.png
And the result is rather strange:
alt text http://img40.imageshack.us/img40/6535/20091201172247.png
Any tips on how to list the active documents?
Thanks,
Chris
Can't answer your specific question, but can make a couple of comments/suggestions:
The DTE object model is ugly, ugly, ugly - you're not the only person who's struggled with it (ask me how I know).
Ask your question on the Visual Studio Extensibility Forum - they can probably help.
Ok,
I just found a way around the ugly DTE. Its simply not using it :-) At least not directly. I found DxCore, which is free (at least for personal use, I guess) and does the job quite nicely.
To get what I wanted, I simply needed this code (which was what I was hoping in VS for, but there it kind of behave different)...
alt text http://img109.imageshack.us/img109/7127/20091201221414.png