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


Similar Messages:

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

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

Databases :: Reading Data From Excel 2007?

Aug 3, 2010

I am attempting to read data from an uploaded spreadsheet using ACE.OLEDB. The code, which is running fine on dev and test machines for XL2003/2007 reports "Exernal table is not in the expected format" error on connecting on the production server for XL2007 only.The code is

Dim connectionString As String = "provider=Microsoft.Ace.OLEDB.12.0;" _ & "Data Source='" & ImportData.FullName & "';Extended Properties=Excel 12.0;" LogWebActivity.LogThis("Entering POPSUKD, ConStr=" & connectionString, LogWebActivity.LogDetailLevel.DetailAndData) Dim con As New System.Data.OleDb.OleDbConnection(connectionString) LogWebActivity.LogThis("Dimmed con", LogWebActivity.LogDetailLevel.Debugging) Try Dim cmdSelect As New System.Data.OleDb.OleDbCommand("SELECT * FROM [" & WorksheetName & "$]", con) Dim adapter As New System.Data.OleDb.OleDbDataAdapter(cmdSelect) Dim dS As New Data.DataSet LogWebActivity.LogThis(cmdSelect.CommandText, LogWebActivity.LogDetailLevel.Debugging) con.Open() LogWebActivity.LogThis("Opened Connection", LogWebActivity.LogDetailLevel.Debugging) adapter.Fill(dS, WorksheetName) LogWebActivity.LogThis("Filled DataAdapter", LogWebActivity.LogDetailLevel.Debugging) _SKUS = dS.Tables(WorksheetName) LogWebActivity.LogThis("Set SKUS", LogWebActivity.LogDetailLevel.Debugging)

View 1 Replies

Databases :: Programmatically Convert Excel 2007 To CSV?

Feb 11, 2011

I'm really stuck tryign to figure this out. Converting XLS to CSV is no big deal or at least it seems that way. However, trying to go xlsx to csv seems to be more difficult. For grins, I grabbed some code that is supposed to read a sample xlsx file and convert that into a gridview called GridView1. I figure it can't be much different to turn that into CSV.

[Code]....

View 9 Replies

Databases :: Reading And Writing MS Excel (2007) Files?

Mar 4, 2011

Want to create a web based application for reading and writing excel files.

Issue :

1. Want to upload an excel file and store it some location.
2. Read data from excel file, performing some sorting and filtering
3. Write filtered data to new excel file.

View 1 Replies

Databases :: How To Get Xml From Excel-2007 File(.xslx) Programmatically

Jan 13, 2010

I need to get the excel data in xml format.

Can anyone share me the code for converting .xlsx file to

xml format?

View 1 Replies

Databases :: Excel Exporting Of RadGrid In MS Office 2003 With 2007?

Feb 17, 2011

I have a Telerik Radgrid i export the data in RadGrid with gridexporting property of radgrid in Excel 2003 i.e .xls but the problem is that my some client's computers have excel 2003 and some have 2007 when this exported radgrid excel data going to be opened in 2007 this shows some message that due to .xls file going to opened in 2007 but after clicking ok button on message its allowed me to open the file, i just wanted to stop this message.

View 2 Replies

Databases :: Load Data From An EXCEL 2007 File To SQL Server 2008?

May 8, 2010

I want to load the data from an EXCEL 2007 file to SQL Server 2008 database. I am geting following error.

The Microsoft Office Access database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.

Following is the complete source code. Kindly any senior member guide me what is the problem in the following code.

[Code]....

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

.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 :: 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

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

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







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