Creating read-only Microsoft Word file using VB.net - vb.net

I am trying to create a Microsoft Word file in VB.net which is read only.
My aim is that user will input the data in a Windows form, after pressing export button it'll get exported to a Word document. But here's a twist: I want this Word file to be read only.
Is there any option to do this? I have tried exporting through Crystal Report, but its still editable.
Any help would be appreciated.

You can use the File.SetAttributes method for that, I think. Check the MSDN site.

Related

How to use VBA to change the default MS Word 2016 options so that when you save as PDF the headings are included as bookmarks?

I'm using Microsoft Word 2016 and looking for a way to run a vba macro that will change the default option to Create bookmarks using: Headings when I save a document as PDF when I click on
File ->
Save As ->
PDF (*.pdf) ->
More options.. ->
Options
Note: The option is only available if you have a table of contents in the document.
The goal is that if a user chooses to save as PDF that option will be already checked.
I'm not asking how to do this manually, like in this question
nor programmaticaly save to PDF using vba like here or here.
Since it's not reachable by VBA at the point of save a file as PDF I do not see it as possible to change that PDF saving option using only VBA.
The only way I see you can reach the behavior you seek is as follow but need some special effort. You need to either create a VTSO addin or be able to have an extra marco file in the Microsoft Word Startup-Path so it will be loaded at Microsoft Word Startup.
Re-implement your own "Save" behavior by overriding the Save functionality (BeforeSave) of Microsoft Word and provide it via your own Save-Button in the Microsoft Word-Menu described here

Filling PDF form using Select.Pdf

I'm trying to fill out a form using Select.Pdf .NET package. Although I've successfully filled a couple of forms, there is a one, which I can't fill.
Here is the link - https://www.state.sd.us/eforms/secure/eforms/E1830V2-WCFRI.pdf
When I try to set some textbox text and the save it it just remains blank. Maybe someone has experience in both PDF and using Select.Pdf, so you could help me.
Thanks!
The PDF in question uses a document level JavaScript which calls resetForm();.
That's where the fields are reset to their default values.

pdf table to excel in Automation anywhere

I am trying to get PDF tables in excel for further processing in Automation anywhere.I tried it like converting PDF to text and then to excel but it not working as required.
Please suggest if anyone did this.
Thanks all who replied and tried to help.
But, i got the solution as there is bot already for this in botstore of AA and we can use it.
We can use this metabot and logic to perform action.
PFB link for the same:
https://botstore.automationanywhere.com/bot/pdf-to-excel/
I think you can use OCR inbuild tool or PDF read tools and take those data items into the variables. And then try to use keystrokes (or other) to add those variables as text in textfile. As well as add those items to the excel sheet. try it.

Programmatically fill in pdf text fields

I have some pdf forms that I am trying to populate the text fields programmatically. The program I am working with is MS Access 2013. I have tried to fill the fields directly, but no such luck. The pdf will be local to the Access database.
Is there a way that I could write the fields to a text file and kick off another script (powershell, javascript or whatever) to read that file and fill in the text fields? Im not familiar with other languages, but will figure it out if it will work.
So the fix is going to be writing to a text file from Access, opening the pdf and inside the pdf is javascript to read in that file and update the fields. A little clunky but it is working.

How can I export the contents of a data bound datagridview to word in vb.net?

I have found ways to do this in c# or asp.net, but I need VB.net. I have a dataviewgrid that I need to export to a .doc file (i am sure I can figure out the formatting and such of the doc). Or, if that is too complex, to an excel file.
There seems to be many asp.net examples, but nothing that works in vb studio on vb.
In the past displayed the datagridview on screen and changed the mime type of the page to application/excel. It will automatically open in an embedded excel file.
Try this link for how to do it: http://support.microsoft.com/kb/317719