I am under the development of a job portal application.
For that I need resume upload functionality.
Now problem is how can I view the uploaded resume?
I am using ASP.NET with VB.
A good example of viewing word documents on a asp.net page can be viewed at http://www.aspsnippets.com/Articles/Display-Word-document-on-web-page-in-ASP.Net.aspx
You can try a third party library called "Doconut", here is a demo which actually shows a resume DOC opened in an asp.net website, similar to your requirements http://try.doconut.com/Ribbon.aspx
This could help anyone else having similar requirements.
Uploading document must have specific path.So try:
Dim objFile as System.IO.File
Dim sReader as System.IO.StreamReader
sReader = objFile.OpenText(“YourUploadedFilePAth”)
I am sure you can find much on this topic via Google as this is a consistently recurring topic
. Here are a few options:
Opening/Editing of Word Documents via ActiveX Controls - Word/Excel ActiveX Controls in ASP.NET
Via Office Object Model (basically a wrapper around COM Objects) - Automating Applications Using the Office Object Model
Via 3rd Party Libraries e.g. NetOffice (netoffice.codeplex.com)
You may use:
Dim filePath As String = "C:\Attachments\fileName.xls" -- any file format
System.Diagnostics.Process.Start(filePath)
Related
I have an ASP.NET Webforms Application where the user can create reports with server-side office Automation. It basically works with FormFields that are being filled out and in the end the user gets a download with the Office document. The Application is quite old and I did not design this software. I'm also aware of the side effects of office server Automation and this article:
https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office
It just works for almost 15 years with several different Office Versions, the newest one is Office 2016 but now I have to know if it still would work with Office 365. It looks like a hybrid solution, Software as a Service but still requires installation on the machine somehow.
It's a little bit hacky to set up like:
IIS Application User needs to take ownership of the following folder:
C:\Programme(x86)\Microsoft Office
C:\Programme\Microsoft Office
C:\Windows\System32\config\systemprofile\AppData
C:\Windows\System32\config\systemprofile\Desktop (sometimes missing
so it needs to be created)
C:\Windows\SysWOW64\config\systemprofile\AppData
C:\Windows\SysWOW64\config\systemprofile\Desktop (sometimes missing
so it needs to be created)
C:\Programme(x86)\Microsoft.Net\
C:\Program Files (x86)\Microsoft ASP.NET\
And in addition, some DCOM Configuration for Word and Excel needed. The IIS Application User needs permission to start the office application etc.
I'm not sure if all the requiered dependency are still there with office 365.
Here is a code snippet:
Function CreateDoc(ByVal docpath As String, ByVal docname As String, ByVal Document As String) As String
Dim ff_name As String = ""
Dim strFileName As String = Nothing
Dim strExtension As String = Nothing
Dim fileBytes As Byte() = Nothing
Try
Dim w = New Word.Application
w.Visible = m_obj.Project.OfficeDisplay
w.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone
w.Documents.Open(docpath)
SetRanges(Document)
Dim i As Integer
For Each ff As Word.FormField In w.ActiveDocument.FormFields
.
.
.
The good news first. If it's work with Office 2016 it should work good with Office 365 too. The bad news now, with the monthly evolution the usage of office interop risk to create issue in the future (in months, or probably more in years), it's difficult without auditing all the solution to give you answer. The next step will be to see if your application could be transform in Web Add-in with offie.js or use Graph API. But unfortunately lot of stuff we do in interop are not possible with the modern solution...
Nothing has been changed so far with desktop editions of Microsoft Office. But I'd recommend using the Open XML SDK for generating documents on the server-side, see Welcome to the Open XML SDK 2.5 for Office for more information.
I've never really had to debug Classic ASP, so this is a little rough and most likely a poor question, but I have done as much research as I could before asking.
I have a request to identify what code prints to a printer, and re-use that code in a new page that someone has built.
While trying to identify that, I've stumbled on a few things that I don't understand, but namely one big one.
The gist is, people can order cookies from the cafeteria, and when they submit, it shows a confirmation page and that order is sent to a printer.
To get a list of cookie options, there's a Server Object created, and from there a method exists, but I cannot identify where it is or where I should be looking. Here's the code:
<%
On error resume next
Const CATAGORY_COOKIE = 1
Dim cookieNames
Dim objCookie
Dim Count
Set objCookie = Server.CreateObject("CookieOrder.CookieRequest")
if objCookie Is Nothing then
Response.Write "Error"
Response.End
End if
cookieNames = objCookie.getAvailable_Item_Names(CATAGORY_COOKIE)
Count = objCookie.Count
Dim sz
sz = Split(cookieNames, ";")
Set objCookie = Nothing
%>
How do I identify what the Server Object is? There's a .dll file that contains binary, but I'm not familiar with how that could be utilized.
I have tried to follow the browser dev tools, but they really haven't been too helpful in this aspect.
I am hoping that learning how this code is executing or where it's being executed I will figure out my other problems.
Bit of background
The project is using a COM+ component. These are defined in Classic ASP using the syntax;
Set obj = Server.CreateObject("[insert COM+ ProgId]")
In this project you are using a component registered with the ProgId
CookieOrder.CookieRequest
There are many out of the box COM+ components available to Classic ASP that provide a lot of common functionality such as;
Visual Basic Scripting Runtime
ActiveX Data Objects
There is also the ability to create COM+ components for use with Classic ASP using languages common to the time like Visual Basic, Visual C++ and more recently using the .NET Framework (C#, VB.NET).
How to locate COM+ libraries
NOTE: Please be careful when accessing the registry as modifying or deleting keys could lead to a corrupt operating system.
Also for the purposes of this guide will use the Scripting.Dictionary ProgId.
The key is using the ProgId to find an elusive COM+ library.
Start %SystemRoot%\system32\regedit.exe (will work in most Windows Operating Systems)
Navigate to the HKEY_CLASS_ROOT hive and select it, then press Ctrl + F to open the Find dialog box.
In Find what type the ProgId in this case Scripting.Dictionary and make sure in look at only Key is checked then press Find or Find Next.
If a ProgId key is found expand to the key and locate the CLSID key which contains a (Default) REG_SZ with the value of the CLSID in the case of this example {EE09B103-97E0-11CF-978F-00A02463E06F}. Double click this value to bring up the Edit String dialog copy the value into your clipboard.
Return to the HKEY_CLASS_ROOT key and use Find to search for the CLSID value which in this example is {EE09B103-97E0-11CF-978F-00A02463E06F} and again make sure Look at has only Key checked then press Find or Find Next.
If the key is found expand and locate the InprocServer32 key in it you will find the location of DLL in the (Default) REG_SZ value. In this example that is C:\Windows\System32\scrrun.dll (this will be different depending on installation location and OS)
What about decompiling?
There's a lot of assumption in the comments about the compiler used to compile the DLL (mainly .NET), but the best way to check is to use one of the many programs out there in the public domain designed for this purpose.
There is a specific question on SO that deals with this;
Answer by #simon-mᶜkenzie to Identifying the origin of a DLL
Application msWord = new Microsoft.Office.Interop.Word.Application();
Document doc;
object objMiss = System.Reflection.Missing.Value;
object endofdoc = "\\endofdoc";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// add blank documnet in word application
doc = msWord.Documents.Add(ref objMiss, ref objMiss, ref objMiss, ref objMiss);
Microsoft.Office.Interop.Word.Paragraph para1;
// add paragraph with document
para1 = doc.Content.Paragraphs.Add(ref objMiss);
}
}
When I am assigning to para1, it is giving error -
Object reference not set to an instance of an object.
On my local machine it is working fine. But on Remote it is giving errors.
Note- MS Office is installed on server.
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. You can read more about that in the Considerations for server-side Automation of Office article.
Consider using the Open XML SDK if you deal only with opel XML file format documents. If you need to work with binary files, look for any third-party components that support the server-side execution.
Instead of Interop (Office COM) you should use OpenXML in your scenario. But mastering OpenXML is quite of a task and most people quickly realize that it pays off to just buy some toolkit which uses it and become productive immediately.
One tool that might fit your needs very well is Docentric Toolkit. It is OpenXML toolkit under the hood (it is licensed 3rd party product). You can create Document Object Model programatically from the scratch. From this point of view it gives you similar results as if using Office COM. You can choose .docx or .pdf output.
It is also very convenient for template-based reporting with output in .docx and .pdf. Our company uses it for several years and we have been developing most of our reports using this toolkit. Report template is designed in Word using special add-in. It is so simple that even some end users are designing reports already. Templates contain visual layout, formatting and placeholders for data.
Once the template is ready, it can be called from any .NET application, where data is prepared in the form of .NET objects (e.g. from database or XML). Final documents are then generated with two lines of code, where templates and data are merged together. Final document is pure .docx document.
Start > Run
"mmc -32" and then add the Component Services snap-in manually
Navigate to Component Services > Computers > My Computer > DCOM Config
Find Microsoft Word 97 – 2003 Document and right click > Properties
Open Identity Tab
Active "The interactive user" instead of the launching user
So I created an ASP.NET 4 application in VS2010, that needs to play sound to the end user, and it is working perfectly in my local development environment. The problem is the sound resource nor the Resources.resx is not being published to the server. Any idea why?
What I did:
1) Under Project Properties Recources I added my sound resource called: soundbyte (containing soundbyte.wav). I noticed this creates a Resource folder with the wav file and under my project a Resources.resx file referencing the file
2) In my code I play the file as follows:
Dim audioFile = My.Resources. soundbyte
Dim player = New Media.SoundPlayer(audioFile)
player.Load()
player.Play()
In the Visual Studio Solution Explorer right-click on Resources.resx and select Properties. Build Action. Set to content.
EDIT: The following resource might also help.
http://blog.andreloker.de/post/2010/07/02/Visual-Studio-default-build-action-for-non-default-file-types.aspx
Ultimately, I found a way to play the sound to the client browser (as opposed to the server the asp app is running on) was to follow the techniques in this example: http://www.vbdotnetheaven.com/UploadFile/scottlysle/PlaySoundsInASPX09032006083212AM/PlaySoundsInASPX.aspx
But I found an even better way in my case was to use Javascript, which doesnt' require the Resources technique.
simply embed the sound on the page after the tag:
<embed src="Sounds/jump.wav" autostart=false width=1 height=1 id="sound1" enablejavascript="true">
Then in javascript setup the function:
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.Play();
}
Finally play the sound in the browser as needed in Javascript:
EvalSound('sound1');
Hey I am coding using Visual Studio 2003. My program worked fine until I introduced a dll I made using CreateObject.
Code:
Set docs2 = server.CreateObject("DocGetter.Form1")
docs2.GetDocument oXMLDom,numID
It appears to be getting stuck at this code. I've already used regasm to register the dll.
What else could be wrong?
Add a reference to the dll in your project and instantiate the object like this:
Dim docs2 As New DocGetter.Form1()
If that doesn't make sense, then fix it so it does. There's no good reason to use CreateObject in .Net code. (Okay, that's hyperbole. But the principal is sound).
Can you clarify - is this a web app or a client (winform) app? Form1 sounds like a winform. ASP.NET runs at the server, so showing a form would be inappropriate - it would happen at the server, not the client. In short, don't do this!
I also can't see where "stored procedures" figures in this, so I've removed the tag.
What are you trying to do? Options for showing something more complex at the client include:
dhtml
flash
silverlight
clickonce [requires windows client]
ocx [not recommended]
I'd bet money that this function isn't defined with this name and/or parameters.
docs2.GetDocument oXMLDom,numID
But because of the way you're instantiating the object, the compiler has no way of knowing this... I think.