How to create a printerSettings file - ms-word

When I change printer settings in Xlsx file, then saving and unzip it, I can see printerSettings folder that contains a printerSettings1.bin file.
But, when I do the same with Docx and Pptx - there is no printerSettings folder nor printerSettings1.bin file.
What do I have do to save the Docx/Pptx files while saving the printer settings in a separate file?

Excel, PowerPoint and Word are all different apps. They share quite a few features but each has its own feature set. PPT doesn't save printer properties the way the other Office programs might. In fact, I'm pretty sure it doesn't save anything unless the user specifically goes to File | Options | Advanced and instructs it to use the specified (limited set of) properties when printing the current presentation.
In that case, it stores the properties to be used in \ppt\presProps.XML

Related

Visio .vsdx format unzip and zip corrupts

I'm attempting to modify a Visio file (Open XML format) without having to use the Windows Visio application. My first experiment is just to use 7zip to unzip a known good .vsdx file that was created using Visio. That is all good; I can view the content of the package. Without making any modifications, I use 7zip to re-zip the content and renamed to .vsdx, but when I tried to open the resulting new file using Visio, it complains that the file is corrupt. Is there a way to manually re-zip the content into something that Visio accepts as a valid Visio file? I suspect that there may be some sort of checks for the validity of the file, but can't find what that may be. Thanks for any input.
I would use some form of OpenXML library to get at the file's guts using some sort of "approved magic".
Understanding that you might not want to do whatever you're doing via programming, I looked for some sort of free editor.
I found this free plug-in for Visual Studio:
https://marketplace.visualstudio.com/items?itemName=bsivanov.OpenXMLPackageEditorforVisualStudio
It works in the free "Microsoft Visual Studio Community 2019" as well. I just opened the dev environment (aka: the application) and dragged a Visio .vsdx file into the app. It opened with a tree-like editor. I was able to dig down until I found the visio > pages > page1.xml "leaf". Inside there, I was able to change some text on a shape, then save the "package".
Whatever this tool does, it saves the file properly, and I was able to open the altered .vsdx file in Visio. And the text that I changed in the editor was indeed changed inside of Visio!
I think I've used this in the past:
"Welcome to the Open XML SDK 2.5 for Office"
https://learn.microsoft.com/en-us/office/open-xml/open-xml-sdk
https://github.com/OfficeDev/Open-XML-SDK
To edit Visio files without the Visio application, you'll still need to understand how Visio works, to some extent.
A simple example:
I changed the text on a shape fairly easily within one of the page.xml files. That was easy. Then I wanted to add a copy of that shape. It was simple enough to copy and paste the whole xml block for the existing shape, then change the PinX and PinY attributes to move the shape to a different location on the page.
But you won't see that shape unless you give it a unique ID within the page. I tested deleting the ID attribute (to see if Visio would figure it out on open and assign one automatically), but it didn't work. If the ID is the same as another shape, the shape is ignored when you open the file. Once I changed ID to something unused, I did see the new copy of the shape.
If you create grouped shapes, or shapes that have advanced behavior (SmartShapes, ShapeSheet formulas, etc.), then this could get complicated. As formulas need to reference other shapes by ID, so you need to manage the IDs! For simple boxes and lines, etc., it might work well (and fast) to generate these things via OpenXML. Good luck!

How to convert a Tableau Packaged Workbook (twbx) to Tableau Workbook (twb)?

I am currently working with a Tableau Packaged Workbook and looking to convert it back to Tableau Workbook, i.e. the pure file without data extract in the file. I've tried to open up the file in Tableau, go to data source and select "live" connection instead of "Extract". The file size did decrease dramatically, but the file name extension didn't change, instead stayed as ".twbx" instead of ".twb". Can I just change it manually, will that mess up the file? Thanks!
BTW, I am using Tableau 9.0 Desktop.
Just found the answer. Actually, we need to open the twb file in Tableau desktop and then go to file - save as - save as type - Tableau Workbook.
Just open your tableau click "Save as" now save your file as .twb instaed of .twbx
it will help!
Another way to approach this is to break the .twbx into its constituent elements.
The .twbx is really just a zip file, so just like .docx and .xlsx files, you can rename the file (or better yet, a copy) with a .zip extension then right-click and Extract All from the context menu. (I'm on Windows and unfortunately cannot offer Apple or Linux equivalents.)
Once the files have been extracted into the resulting folder, the .twb file will be in the root whilst the .tde data will found nested in folders cunningly called, Data --> Datasources.
You can also right click on a .twbx file in finder or file explorer and choose unpackage workbook

How to force Word to do a SaveAs on generated document

We have a system where we are generating a report as a Word document (using RDLC).
The report is created in a temporary directory, and then Word is launched to display it to the user.
Word is launched, and the report loaded by:
_wordApplication = (Word.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"));
object tempFileNameObj = documentPath;
_wordDocument = _wordApplication.Documents.Open(ref tempFileNameObj);
What I want is to convince Word that this is really a newly created, unsaved file, so it will give the user a SaveAs dialog when they save it (rather than save back to the temporary location).
Ideally, I would like to be able to specify the target directory, and offer a default name.
While the Word is being launched, I can do what I like using Automation, but after Word has been launched, my application will be disconnected from Word, and I would prefer not to leave any macros floating around in the document.
You can rename your .doc file to .dot (Word Template) and if you launch it afterwards, it will create a new File looking exactely like your .doc
If you're not using a macro I believe that the only way to archieve this would be to save the file that they will download be a read-only or user defined template file this way if they wan't to make changes to it they wil have to save it with another name in their computer to save the changes made. If you can use a macro you can archieve more options and even force a save as dialog when the document is opened or when it's closed. I hope this helps as I couldn't find any more information without using a macro.

Powershell [Add-Content/Write-Host] : Adding a hyperlink to plain text

I have written a Powershell script to perform some actions:
Read a .xls file
Compile certain .c files
Copy output files.
I log everything performed by the script to a Log file (e.g. output.log)
I later invoke a tool which performs an analysis of the actions performed by the script and writes them into an Excel sheet.
I would also like to write the path of the excel sheet inside output.log and also provide a hyperlink to it but I have not been able to do so.
Example:
Currently the link to the excel sheet is written as file://\\10.128.163.188\d\abc.xls, but I would like to have a hyperlink to it.
Can you please suggest how to do that?
p.s. I am not working with HTML Docs / UI (i found many examples for the same), but for adding a hyperlink into a plain text written inside a .txt file, i couldn't find any.
You cannot add hyperlinks to a plaintext document. It does not have that functionality.
It has to be a rich text file (.rtf), or a Microsoft Word Document (.doc), or a HTML file.
There is no way around this.

Identify docx pptx xlsx and other msoffice files correctly rather than applicaton/zip

Currently, im working on a perl script that should allow a file to be uploaded, and then process it, and then send it to a printer.
http://code.google.com/p/web-printer-http/
Apparently, both zip and microsoft office files ending in "...x" identify themselves as application/zip when using /usr/bin/file.
Any idea to differ them?
The differing should not be based on extension since the uploading system may be unabe to use extensions (like mobile phones and such).
Rather, it should judge the content entirely based on file content.
There's no way to distinguish between a .zip file and an Office Open XML file (like .docx, xslx, .pptx, etc) without peeking inside the zip.
All of the various open XML formats use .ZIP compression. Therefore they are zip files.
If the zipfile conforms to the Open Packaging Convention, then it may also be an Open XML (Office) document.
A good heuristic is if the zip file contains a file called /[Content_Types].xml, then it is an OPC file. To determine if the zip file contains a file of that name, you must read the zipfile directory. Use a zip library to do that.