openxml

Freeze Panes in OpenXml SDK 2.0 for Excel document

天大地大妈咪最大 提交于 2019-12-07 03:09:56
问题 I'm generating an Excel workbook using OpenXml and have been following the examples at http://msdn.microsoft.com/en-us/library/cc850837.aspx It would be really useful if I could freeze the top panes, but I can't find a way to do this. I realise that I can do this if I use http://closedxml.codeplex.com/ but for now I'd like to stick to the OpenXml SDK Any ideas? 回答1: I was trying to solve the same problem and ended up opening the Open XML SDK 2.0 Productivity Tool and using the Compare Files..

How to add section break next page using openxml?

天大地大妈咪最大 提交于 2019-12-06 21:59:54
问题 I want to add a section break at the end of the document and add some text. My code is as below: using System; using System.Collections.Generic; using System.Linq; using System.Text; using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Wordprocessing; namespace WordDocManipulation { class Program { static void Main(string[] args) { string path = @"C:\sample.docx"; string strtxt = "Hello This is done by programmatically"; OpenAndAddTextToWordDocument(path,strtxt); } public

What .xlsx file format is this?

不想你离开。 提交于 2019-12-06 19:09:28
Using an existing SSIS package, I was trying to import .xlsx files we received from a client. I received the error message: External table is not in the expected format These files will open in XL When I use XL (currently XL2010) to Save As... the file without making any changes: The new file imports just fine The new file is 330% the size of the original file When changing .xlsx to .zip and investigating the contents with WinZip: The original file only has 4 .xml files and a _rels folder (with 2 .rels files): The new file has the expected .xlsx contents: Does anyone know what kind of file

I am merging two Word documents with OpenXML SDK but get a corrupt document when copying an image into a header

好久不见. 提交于 2019-12-06 15:56:28
I have code which works in all sorts of different situations, including when copying images into the body of the document. The code works when copying (adding) headers and footers from one document to the other, as long as the headers/footers being copied do not contain images. When I copy a header which has an image in it, then the resulting file is corrupt, and when I try to open it with the OpenXML SDK it throws an exception saying "Compressed part has inconsistent data length". I do know that the image has to be created in the HeaderPart (as against the MainDocumentPart when copying into

Copying a worksheet in OpenXML that has previously been modified

微笑、不失礼 提交于 2019-12-06 14:32:16
问题 I have followed the routine used here to copy a worksheet in a workbook into the same workbook by using .AddPart<>() and a temporary workbook to serve as a middleman, but have come up with some issues. Prior to copying the worksheet, I have made modifications to it. However, the copied version of the worksheet retains the original sheet, not the modified one. Here's the code: Document = SpreadsheetDocument.Open(filename, true); SetupPages(0, nSections); CopySheet(1); SetupPages() simply gets

Saving an xml document results in corrupt file

坚强是说给别人听的谎言 提交于 2019-12-06 13:35:27
I have a question on how to save an xmldoc as a word file. I want to open the word file, do some manipulation on the undelying xml structure using the xmldocument class and then resave it back to the word file. This is what im currently doing: using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(@"E:\HelloWorld.docx", true)) { MainDocumentPart mainPart = wordDoc.MainDocumentPart; var xmlDoc = new XmlDocument(); using (Stream partStream = part.GetStream()) using (XmlReader partXmlReader = XmlReader.Create(partStream)) xmlDoc.Load(partXmlReader); //xml node manipulation here

How to grab text from word (docx) document in C#?

家住魔仙堡 提交于 2019-12-06 08:51:22
问题 I'm trying to get the plain text from a word document. Specifically, the xpath is giving me trouble. How do you select the tags? Here's the code I have. public static string TextDump(Package package) { StringBuilder builder = new StringBuilder(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(package.GetPart(new Uri("/word/document.xml", UriKind.Relative)).GetStream()); foreach (XmlNode node in xmlDoc.SelectNodes("/descendant::w:t")) { builder.AppendLine(node.InnerText); } return builder

how to calculate the rotation value for the MS Office Powerpoint Shapes from the xml data given

空扰寡人 提交于 2019-12-06 08:09:48
问题 I want to get the proper rotation value to draw the shape of the MS office Powerpoint 2007 file from the given OOXML data as below : <p:sp> <p:nvSpPr> <p:cNvPr id="3" name="Rectangle 66" /> <p:cNvSpPr> <a:spLocks noChangeArrowheads="1" /> </p:cNvSpPr> <p:nvPr /> </p:nvSpPr> <p:spPr bwMode="auto"> ***<a:xfrm rot="5400000">*** <a:off x="2443049" y="-1042472" /> <a:ext cx="304800" cy="4419600" /> </a:xfrm> <a:prstGeom prst="rect"> <a:avLst /> </a:prstGeom> <a:ln> <a:headEnd /> <a:tailEnd /> </a

Add style to Excel in openxml

久未见 提交于 2019-12-06 07:51:44
I want to set forecolor of the text in the excel document which I open to write the text. For that I tried : var stylesheet1 = spreadSheet.WorkbookPart.WorkbookStylesPart.Stylesheet; Fills fills1 = new Fills() { Count = (UInt32Value)5U }; Fill fill5 = new Fill(); PatternFill patternFill5 = new PatternFill() { PatternType = PatternValues.Solid }; ForegroundColor foregroundColor3 = new ForegroundColor() { Rgb = "#FF0000" }; patternFill5.Append(foregroundColor3); fill5.Append(patternFill5); fills1.Append(fill5); stylesheet1.Fills.Append(fills1); var fid = stylesheet1.Fills.Count++; wbsp

Need suggestions on how to extract data from .docx/.doc file then into SQL Server

懵懂的女人 提交于 2019-12-06 07:33:16
问题 I'm suppose to develop an application for my project, it will load past-year examination / exercises paper (word file), detect the sections accordingly, extract the questions and images in that section, and then store the questions and images into the database. (Preview of the question paper is at the bottom of this post) So I need some suggestions on how to extract data from a word file, then inserting them into a database. Currently I have a few methods to do so, however I have no idea how