Web Forms :: Displaying Word & Excel 2007 Documents?

Jul 22, 2010

I am loading documents into our Oracle database and then retrieving them for the users to view. So far PDF, DOC, XLS, CSV, etc. all perform as expected, however; DOCX, XLSX, etc. files have one annoyingly persistent issue. When the document is downloaded by the user and they open it you get the first in a series of messages: The file 'thefile.docx' cannot be opened because there are problems with the contents. Details: The file is corrupt and cannot be opened. and then: Word found unreadable content in 'thefile.docx'. Do you want to recover the contents of this document? If you trust the source, click Yes. After clicking yes the file opens and all of the content appears correct. Including images, formatting, tracked changeds and comments, equations, etc. I have tried multiple methods along these lines to no avail. I simply want the files to open without the false-positive error messages. I am using VS2010, with the website targeted at .Net Framework 2.0.

objConn =
New
OracleConnection(gstrConnectionString)
objConn.Open()
cmd = New
OracleCommand
cmd.Connection = objConn
cmd.CommandText = "select DOCUMENT_NAME,DOCUMENT_TYPE,DOCUMENT
from DOCUMENT_TABLE where DOCUMENT_ID='"
& strDocumentID & "'"
dr = cmd.ExecuteReader
dr.Read()

View 5 Replies


Similar Messages:

Databases :: Displaying Word & Excel 2007 XML Documents From ASPX?

Jul 23, 2010

I am loading documents into our Oracle database and then retrieving them for the users to view. So far PDF, DOC, XLS, CSV, etc. all perform as expected, however; DOCX, XLSX, etc. files have one annoyingly persistent issue.

When the document is downloaded by the user and they open it you get the first in a series of messages:

The file 'thefile.docx' cannot be opened because there are problems with the contents.

Details: The file is corrupt and cannot be opened.

and then:

Word found unreadable content in 'thefile.docx'. Do you want to recover the contents of this document? If you trust the source, click Yes.

After clicking yes the file opens and all of the content appears correct. Including images, formatting, tracked changeds and comments, equations, etc.

I have tried multiple methods along these lines to no avail. I simply want the files to open without the false-positive error messages.

I am using VS2010, with the website targeted at .Net Framework 2.0.

objConn =
New
OracleConnection(gstrConnectionString)
objConn.Open()

[Code]....

View 15 Replies

DataSource Controls :: How To Export DataTable To Word 2007 / Excel 2007 & CSV

Mar 23, 2010

I am using the below code to Export DataTable to Word,Excel,CSV format & it's working fine. But problem is that this code export to MS Word 2003,Excel 2003 & CSV version. I need to Export my DataTable to MS Word 2007,Excel 2007 & CSV because I am supposed to handle more than 100,000 records at a time and as we know Excel 2003 supports for only 65,000 records.

how to export DataTable or DataSet to MS Word 2007,Excel 2007 & CSV.

[Code]....

View 1 Replies

How To Stream An Excel 2007 Or Word 2007 File Using C#

Mar 25, 2010

I'm working on a web app and need to stream various files. I can do pdfs, images, and older Office documents. However, when I try to do with 2007 documents, it breaks. Here is my code:

Response.Buffer = true;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
switch (FileExtension.ToLower())
{
case "pdf":
Response.ContentType = "application/pdf";
break;
case "doc":
Response.ContentType = "application/msword";
break;
case "docx":
Response.ContentType = "application/vnd.ms-word.document.12";
break;
case "xls":
Response.ContentType = "application/vnd.ms-excel";
break;
case "xlsx":
Response.ContentType = "application/vnd.ms-excel.12";
break;
default:
Response.ContentType = "image/jpeg";
break;
}
Response.BinaryWrite(buffer);

The error that I get is:

An invalid character was found in text content. Error processing resource 'http://DomainName/GetFile.aspx.

View 2 Replies

How To Export A Datatable To MS Word 2007 / Excel 2007 And Csv

Mar 23, 2010

I am using the below code to Export DataTable to MS Word,Excel,CSV format & it's working fine. But problem is that this code export to MS Word 2003,Excel 2003 version. I need to Export my DataTable to Word 2007,Excel 2007,CSV because I am supposed to handle more than 100,000 records at a time and as we know Excel 2003 supports for only 65,000 records.

how to export DataTable or DataSet to MS Word 2007,Excel 2007.

[Code]....

View 1 Replies

Web Forms :: Retrieving Displaying Word 2010 Documents From SQL 05 In Varbinary (MAX)

Mar 21, 2012

I am retrieving a word 2010 document that has been uploaded to a sql 2005 database. When I subsequently download and open the document in a word window it states the file is corrupted and gives the user the option of repairing the file for display. This always works fine but the corrupted message is always presented for all DOCX files. The DOC files from an older Word version work fine without incident. the section of code, VB.NET, for streaming the document out to display in Word is: 

Dim bytes() AsByte = CType(dt.Rows(0).Item(2), Byte
())
Response.Buffer = True
Response.Charset =
""Response.Cache.SetCacheability(

[Code] .... 

Where the content type value, in this case, is "application/vnd.openxmlformats-officedocument.wordprocessingml.document" (rather than "application/vnd.ms-word").

The filename is simply the full name of the document and the data itself is loaded into the Bytes var. I got some time back... it just doesn't like the new and improved word 2010 files.

View 1 Replies

Web Forms :: Upload Word PDF And Excel Documents To SQL Server Database?

Nov 25, 2011

I want to know how to upload Word, PDF and Excel documents to SQL Server database in ASP.Net

View 1 Replies

Msword - Convert Word 2007 Document To Word 2003 Programmatically ?

Apr 15, 2010

any component or library (preferably open source) that would allow me to convert Word 2007 documents to Word 2003 with ASP.NET?

View 3 Replies

Using Microsoft.Office.Interop.Word To Convert Uploaded Word Documents Into Previewable Html Files?

Feb 3, 2010

I'm hoping this is an easy one...I'm using Microsoft.Office.Interop.Word to convert uploaded word documents into previewable html files. I haven't implemented it fully, but I've played around with it enough that I think I have a plan that will work... My question revolves around

[Code]....

I'm not in love with the idea of opening word and closing it everytime there's an upload (which I hope is a lot of the time) I'd like to make this a shared object that loads at application start. I have 2 questions
that go along with this. 1. I imagine that winword could lock up and that would be a problem, right? 2. to save a document I use wordapp.ActiveDocument, this could have an issue as a shared object, right? I think I'm talking myself right out of this...

View 1 Replies

Web Forms :: Reading Word Documents With Out Using Com Components

Mar 8, 2010

I would like to know is there any way to read word documents with out using COM components from ASP.NET application.

View 1 Replies

Web Forms :: Display Word And PDF Documents Directly In Browser

Jan 4, 2013

<a href="untitled.GIF">untitled</a>
<a href="aaa.txt">aaa</a>
<a href="DaryaSoft_FaxList_pdf.pdf">pdf</a>
<a href="4663750304151.swf">swf</a>

when I click on gif and txt file links I can see Image and content of txt file in page and their address in address bar but by clicking on swf and png files link download dialog box appear? I need to remove this type of files from htaccess and I searched and found the Equivalent of htaccess is authorization section of web.config but I don't know..I need when click link I can see file and it's address in address bar.

View 1 Replies

Web Forms :: Open A Mht File With Word 2000 / 2003 2007

Jan 22, 2010

I open a mht file with the streamreader and I do some handling with the file.

Then I would like te open this content with word (200,2003,2007).

What's the correct content type to use for the Response.WriteFile method ?

As normally a mht file has content type multipart/related ...

The code i use is:

[Code]....

View 2 Replies

.net - Manipulating Word 2007 Document XML In C#

Jan 25, 2011

I am trying to manipulate the XML of a Word 2007 document in C#. I have managed to find and manipulate the node that I want but now I can't seem to figure out how to save it back. Here is what I am trying:

// Open the document from memoryStream
Package pkgFile = Package.Open(memoryStream, FileMode.Open, FileAccess.ReadWrite);
PackageRelationshipCollection pkgrcOfficeDocument = pkgFile.GetRelationshipsByType(strRelRoot);
foreach (PackageRelationship pkgr in pkgrcOfficeDocument)
{
if (pkgr.SourceUri.OriginalString == "/")
[code]...

View 4 Replies

How To Store And Search Word Documents Using C#.NET

Feb 13, 2010

i want to store a word documents (.doc) in the database and i need to provide search over a collection of Word documents and highlight the words too.

I m using VS2005 --> ASP.NET, C#.NET, SQL Server.

View 3 Replies

Exporting Word Documents To PDF Programatically?

Mar 26, 2010

I'm looking for a way to export a Word document as a PDF. I would like to do this without the use of a "software printer" (such as CutePDF, etc.) and stick to reference assemblies if at all possible. I'm using Microsoft Office Interop Assemblies to generate a Word Document which I save to a temporary directory. So its not necessary for this solution to interact directly with Microsoft Office, unless it needs to.

View 1 Replies

How To Allow Word Documents (.doc) To Be Downloaded Over HTTPS Using IE8

Mar 16, 2011

One of my sites is on HTTPS and includes a document repository which has a lot of Office documents (.doc, .docx, xls, etc...)

We recently found that these may not be downloaded using IE8. Further research led me to this article.

[URL]

The resolution states to "remove the no-cache header" which is required by design. I found the following article describing how to do so:

how do i remove the security risk, due to cached version of page.

Unfortunately, the methods explained have not worked.

View 1 Replies

Editing Word Documents In A Webpage?

Sep 28, 2010

I have a need for users to be able to edit word documents from my web page.

Are there any editors, or components, that will allow me to do this?

A bit of background, the user will be able to upload a word document to my site and then view/edit it from there. There will be no requirement for the user to download the document again but ideally I'd like to keep the document as a word doc at my end.

View 2 Replies

Read Microsoft Word Documents In .NET?

Jan 30, 2010

How to read doc, docx file into .NET with C#.

View 5 Replies

Web Forms :: Create Excel 2007 File?

Sep 13, 2010

On Previous version of my application, if I want to export my data from SQL Server to Excel 2003 file, I just retrieve data from the SQL server and then straight away show "Open, Save, Cancel" dialog box to get the data on Excel 2003 Format. Here is the existing code in C#.

public void ExportToExcel(string StrFileName, DataTable dt)
{
if (dt!= null && dt.Rows.Count > 0)[code]....

but when I want to Export to Excel 2007 format with the same. I don't have any Idea to export it.

View 3 Replies

Web Forms :: Exporting Page To Excel 2007

Apr 11, 2012

 I need to export asp.net page toexcel 2007. when i wrote the code as below:

protected void Button2_Click(object sender, EventArgs e) {Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = ""; Response.ContentType = "application/vnd.xls"; System.IO.StringWriter string
Write = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter html
Write = new HtmlTextWriter(stringWrite); div1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString()); Response.End(); } 
publicoverride void VerifyRenderingInServerForm(Control control) {   
} and

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="poprint.aspx.cs" Inherits="print_poprint" EnableEventValidation="false" %>

It displays message as shown

The file you are trying to open is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

When yes is clicked it opens in excel but in some other format I think for I cannot AUTOSUM or sum the values result always as zero for numbers appears as text as " 222" . even if i try to format cells with numbers it does not works.

View 1 Replies

How To Detect A Password In A Word 2003 Or 2007 File

Apr 14, 2010

My users like to upload password-protected Word documents into our custom document management system. I'd like to add a validation to check for the password and refuse the upload if it has a password.

Automating Word - with COM interop - is out of the question because this is a server side application.

View 3 Replies

Export Crystal Report To Microsoft Word 2007?

Jun 4, 2010

how to export crystal report to Microsoft Word 2007.what will be the content type of it.I use in VB.NET 2002.

View 1 Replies

Web Forms :: Exporting To Excel 2007 (XLSX Format)

Mar 13, 2012

in my web application page i have a option to export to excel . I am able to export the data to Excel but have 2 issues

 1)  i hav ethe option of exporting in .XLS or .XLSX format

i am able to export in .xls format from any system ie the system having office 2007 or 2003

but when i am trying to export in .XLSX format i get error

Microsoft Office Excel---------------------------The file you are trying to open, 'noup.xlsx', is in a different format than specified by the file extension. Verify that the file is not corrupted and that the file extension matches the file format---------------------------Ok---------------------------

2) when exporting i want the excel sheet to be saved with the name thats selected from a dropdown

suppose the dropdown has text selected as CITY

i want the excel sheet as CITY.XLS/.XLSX

i my developemnet system it works fine with below code

string filename = dropdown1.SelectedItem.Text
if (Extension.SelectedValue.ToString() == ".xls")
{

[Code].....

but on production server i get the name of .aspx page

View 1 Replies

Merge Word Documents (Office Interop & .NET) - Keep Formatting

Mar 25, 2010

I'm having some difficulty merging multiple word documents together using Microsoft Office Interop Assemblies (Office 2007) and ASP.NET 3.5. I'm able to merge the documents, but some of my formatting is missing (namely the fonts and images). My current merge code is shown below.

private void CombineDocuments() {
object wdPageBreak = 7;
object wdStory = 6;
object oMissing = System.Reflection.Missing.Value;
object oFalse = false;
object oTrue = true;
string fileDirectory = @"C:documents";
Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document wDoc = WordApp.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
string[] wordFiles = Directory.GetFiles(fileDirectory, "*.doc");
for (int i = 0; i < wordFiles.Length; i++) {
string file = wordFiles[i];
wDoc.Application.Selection.Range.InsertFile(file, ref oMissing, ref oMissing, ref oMissing, ref oFalse);
wDoc.Application.Selection.Range.InsertBreak(ref wdPageBreak);
wDoc.Application.Selection.EndKey(ref wdStory, ref oMissing);
}
string combineDocName = Path.Combine(fileDirectory, "Merged Document.doc");
if (File.Exists(combineDocName))
File.Delete(combineDocName);
object combineDocNameObj = combineDocName;
wDoc.SaveAs(ref combineDocNameObj, ref m_WordDocumentType, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
}

I don't care necessarily how this is accomplished. It could output via PDF if it had to. I just want the formatting to carry over.

View 1 Replies

Controls :: How To Edit Word Documents Online In Browser

May 7, 2015

how  work Microsoft word  editor  in asp.net?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved