Eric White
Forum Replies Created
-
AuthorPosts
-
At this point, the best way to do this is to either automate PowerPoint, or use PowerPoint Automation Services in SharePoint, if that is an option for you.
I don’t know of any open source libraries to do this. There may be commercial products, but I have no experience with them.
May 13, 2016 at 3:50 pm in reply to: Inserting document in existing document with different Page Layout #3400If you get to the point where you are blocked, then remember it is pretty easy to open the document, find the section properties, and adjust them per your need.
We certainly want to get this issue resolved, but in the meantime it need not block you. 🙂
There isn’t an option in WordprocessingML to set the header/footer for the last page.
There also isn’t any code that I know of to properly paginate a document, and without paginating a document, there is no way to know of the contents of the last page. Is the last page in its own section? Is there are hard break before the last page that you can use to identify the last page?
May 13, 2016 at 10:16 am in reply to: Inserting document in existing document with different Page Layout #3396Hi Thiery,
Right now I am buried in another project, and it is definitely proving to be one of the more difficult projects that I have taken on. (The project is comparing two DOCX files, and producing another document that contains tracked revisions.) Unfortunately, I underestimated this project, and must focus on this to the exclusion of all else until I complete it, due to contractual obligations.
I may come free in a couple of weeks, and then can research this.
Sorry for this response, but have no options regarding this currently.
-Eric
Dealing with styles in SpreadsheetML is an area that definitely needs more content – how it works, and how to generate it. Styling is definitely optimized for quick reading of spreadsheets, not for ease of modification of styling.
Have you taken a look at the ClosedXml library (https://closedxml.codeplex.com/). I haven’t used it, but have heard good things about it.
Hi,
VML is strange – it looks like XML, but it is not.
There is, I recall, a way to ‘hack’ the VML so that it can be read by an XML parser, but I don’t recall the details.
Right now, I am fully engaged in completing a module that enables comparing two DOCX files and producing another file that contains tracked revisions, and contractually need to finish this ASAP, so can’t spend any time researching this. However, I do recall doing this at one point.
Question – why are you using a presentation that contains VML? It is deprecated. If you load the presentation in PowerPoint, and then specify the right option, then I believe that you can save the presentation in such a way that it replaces VML with DrawingML.
-Eric
Hi,
I have not written any code to do this, and am unaware of any open source code to do this, although there probably is something out there.
In preparation to go down this road, quite some time ago, we built a formula parser for formulas in SpreadsheetML – this parser is in Open-Xml-PowerTools. Take a look at the Formulas01 example. However, due to a variety of reasons, after completing the formula parser, we have not continued on this path. These were business reasons, not technical reasons.
-Eric
May 13, 2016 at 9:55 am in reply to: Changing Document Type Renames Workbook.xml to Workbook2.xml #3392An application that consumes or produces Open XML should never care what the name is of the workbook part. Identification of parts is never done via the URI; instead it is always based on content types and relationship types. It is a bug in these other libraries / applications if they stop working based on the actual URI of any part.
I understand that this doesn’t help us – we need to use libraries and applications that may contain bugs. However, I do not anticipate that such a change will be coming to the Open-Xml-Sdk.
Have you raised this issue with the maintainers of those other projects?
Alternatively, you could use System.IO.Compression to go into the XLSM and change the name of the workbook part. It would not be hard. However, you would need to be careful to do it correctly.
Are you fully familiar with the Open Packaging Conventions? If not, watch screen-casts 11 and 12 in the following series:
Cheers, Eric
Hi,
No, I don’t have a TextReplacer for Excel files. It is a great idea, though.
Doing a TextReplacer for SpreadsheetML is fairly complicated. Text can be stored in the shared string table, or it can be directly in cells. If text were in the shared string table, then depending on the behavior you want, the modification of the shared string table could be a bit complex.
One pretty big complication – if text is in a cell that is a column heading for a table, and if there are formulas elsewhere that refer to that table and column, then those formulas would need to be modified. Without doing this, you would end up with an invalid spreadsheet. You could disallow changing column headings, but even doing this check isn’t so simple.
-Eric
Are ‘first page’ and ‘title page’ synonymous in your description of the issue?
Is there a title page in the template document, which does not have a header/footer?
I have a suspicion about the source of your problem. There was another bug in DocumentBuilder, where if a section contained a ‘first’, header, and then if there was another section that had the option ‘Link to Previous’ set, then it would ‘inherit’ the even and default headers/footers from the previous section, which is almost certainly not what was wanted. Therefore DocumentBuilder ‘fleshes out’ the headers and footers for a section, copying, for instance, the default header to the first and even header, if they were not set. I am not certain about the exact dynamics of the bug that you are seeing, but I suspect it is in this area.
I am under a deadline that prohibits me from spending much time, but here is a plan:
- For now, after running DocumentBuilder, you can open the document, and ‘tweak’ the headers and footers to get them to be exactly as you wish.
- Also, please post your documents on DropBox or OneDrive, so I can test with them.
I need a more exact, precise description of your issue, for example:
- In the template document there are two(?) sections. The first section has headers and footers set for even, default, and first, (or whatever). The first header has such and such. The default header has blah blah. The section section has only the ‘default’ header. It contains …. And so on. Please be very precise.
- The inserted document has only the default section, which has the ???? headers and footers. However, I am setting keepSections to false, and these sections do not show up in the generated document.
- And so on. This is only an example. I need to know precisely what your situation is, and what is the erroneous behavior.
After I complete my current project, as soon as is possible, I can take a look.
However, it is pretty easy to open up a document and tweak the headers / footers, so this will get you going, so your project is not blocked.
-Eric
Hi Ian,
No, WmlToHtmlConverter does not deal with sections, headers, footers, or page breaks. This is, by the way, the most requested feature for this module. However, it is a large project, and is not currently on my schedule.
Cheers, Eric
Hi Thierry,
I’m not fully clear on your issue. Looking at the markup, there is no header/footer for the first page – only for default.
-Eric
Hi Thierry,
Glad you got the issue resolved.
I don’t currently have a way to attach a document to a forum post. For now, what I ask is that when necessary to do this, put the document on DropBox or OneDrive, and put a link in the post. FYI.
Even though you have the issue resolved, this does point out a bug – DocumentBuilder should not fail in this way, even if the section properties are in the wrong place.
Cheers, Eric
Hi Prince,
I believe that the best approach is to convert to HTML, and then convert to DOCX using HtmlToWmlConverter, a module in Open-Xml-PowerTools.
To convert your XLSX to HTML, you might start with the SmlDataRetriever module in Open-Xml-PowerTools. This module retrieves the data from a named range, a table, or a range, and outputs XML that includes the display value and the formatting information.
SmlDataRetriever: Better Approach for Retrieving Spreadsheet Data
Cheers, Eric
Hi Ian,
What font size do you see when you look at the document in Word? And what font size do you see in the CSS?
If, after looking at the font sizes, the numbers do not match up, if you like you can post the file on dropbox or onedrive, and I will take a look.
Cheers, Eric
-
AuthorPosts