Avoid printing character vbFormFeed as up arrow - vb.net

I have a program in visual basic that prints some large reports, sometimes with hundreds of pages. There is a lot of encapsulation here, but it boils down to us using the PrintDocument.Print() command to print the document. When it prints, it prints the form feed characters as up arrows (in windows 10). Is there anyway to get these to print as blanks, and just have them start a new page?
Let me know if you need anymore details. This is my first Visual Basic experience and I'm not sure what info would be useful.

Okay, I don't know if anyone else will encounter this, but I fixed it, so maybe my method will help you. There is a PrintPage event handler that fires off when you are printing, and basically it's just a matter of reading a string up to the form feed character, substringing that off to another string and then printing that other string, then culling it from the original string. Making sure you remove the vbFormFeed character from each page.

Related

Word cannot undo this action. Do you want to continue?

I have a document into which I copy all kinds of VBA code regarding questions asked on this site and write code in preparation for answers. This document was created on my PC (with Word 2010). It has no event procedure that runs on the Save event, but at some point a few weeks back it started to ask me the above question before every save, including automatic saves. The document is based on the Normal template which has no code in it. I don't know which code may have caused this to start, nor which code to even suspect. Other documents open in the same instance of Word save normally. It's only this one document that is affected.
The document also contains a lot of special items, like content controls, fields, ActiveX controls, EndNotes, tables and comments. I suspect the comments to be related to this problem in some way.
I know that I could probably stop the alerts by disabling alerts but that isn't what I want. I want Word to display all the normal alerts. It's just this abnormal one which I would like to switch off. Any ideas how to do that? Or what caused Word to issue that alert in the first place?
In these situations I make several backups of the document and then start looking for something that is broken. So using a new backup each time, I systematically delete portions of the document to see if the unwanted / unexpected behavior disappears. For example I first try to isolate the issue to the top of bottom 1/2 of the document. If I can establish that the issue is related to the bottom half then I delete half of the bottom half of the document and so on... it can take a while but it has been an effective method of finding issues for me.
That said, I tried this on a document recently and just ended up going round in circles. I thought I had narrowed the issue down to a single corrupt image, but that turned out to be NOT the case.
I've also found that there are some things that I can do with VBA that Word simply can NOT undo... I'm only aware of a few things (which I'd have to look up in my notes) but I'm sure there's a whole list of things.
A possible workaround might be to clear the undo history for this specific document prior to saving, I imagine that will suppress the message and save you from losing the standard notifications. Hope it helps :)
Good luck!

I need to fetch the co-ordinates of word from a multiline textbox in silverlight

I have spent an entire day to implementent functionality like GetRectFromCharacterIndex() with no success. Microsoft has not implemented it for Silveright 4.
I need to fetch the co-ordinates (Start & End) of word of a multiline text box in Silverlight 4. It should be noted that the textbox is wrappable. I am not able to find it since a new line and a wrapped lines are two different thing. I am unable to to find the end of line for a wrapped line.
Is it possible to fetch the exact co-ordinates (It is not index of char in string/textbox) of word in a multiline textbox?
Thanks in Advance.
Regards
Sudhir Kumar
Turns out GetRectFromCharacterIndex wasn't implemented in SL5 either.
The only way you can do this is to implement it manually.
To see example how it can be done, you can look at this answer. Be careful, though, since calculating such thing yourself is usually a performance killer.

UITextInput - Is it OK to return Incorrect 'beginningOfDocument' & 'endOfDocument'?

I'm creating my own Text Editor in iOS using Core Text. Pretty much everything works great with one exception: Stuff really starts to slow down when the text document is "large". I've discovered that iOS is requesting the entire document text on every change, including selection changes (at least, when I notify the UITextInputDelegate of selection changes). Part of the problem is that I've already optimized my Core Text code by splitting up the document into paragraphs and rendering only the paragraphs that change. But doing this also split up the document string (which is a NSAttributedString) into the separate 'paragraph objects'. So when iOS requests the entire text document, I have to combine all those strings into one string, which takes time and memory.
My solution is to give iOS incorrect UITextPosition's for the beginningOfDocument and endOfDocument methods, limiting those positions to the paragraph(s) intersecting the current selection. This is actually working very well. iOS is now only requesting the current paragraph(s) of the change, which has completely eliminated the slow-down.
So far, so good, but I'm a little worried that this might break something. I've tested this a bit and nothing is broken, but Text Editors can be hard to test (who knows if it'll break in some edge condition).
I have 2 question:
Should iOS be requesting the entire document text on each change? If not, then perhaps some other method in my UITextInput protocol methods that are returning the wrong value, somehow causing iOS to request the entire document.
Does anyone know if this will actually break anything?
Alright, I've been testing this for quite a while now and I've finally found a place where using this technique will break functionality. UITextInput uses beginningOfDocument and endOfDocument to determine whether it has room to "move" when you press the arrow keys on a bluetooth keyboard. Returning only the beginning and end of the currently selected paragraph(s) cause it to ignore the 'arrow' buttons when it is at the beginning or end of that paragraph and those arrows indicate an attempt to move outside what it thinks is the beginning/end of the document. It's easy enough to fix. If the currently selection begins at the beginning/end of a paragraph, I now also return the previous/next paragraph as part of the document, respectively.

When selecting something in VB with code-assist, I don't want VS10 to make a new line

Usually I code C# in VS10, but I have to code a small program in VB.NET in VS10.
And I am used to selecting something with code-assist with Enter, but now in VB Enter also make a new line, which is very annoying because I can't help doing that all the time.
How can I turn this off/on so it's like when I code C#? I have looked, but could not find anything.
You cant, you have to get used Tab or Space.

I'd like to preview a Word document on form

Update2: For now, I'm considering saving a temporary copy of the document in html format to display it, but this kills my idea to show the user's real time affect on the document. It's just bad practice to re-save at every character input and reload the browser. So, I suppose this may just be impractical for now. I'll keep my ear to this thread for any answers that might arise. Thank you for your help.
Update1: The WebBrowser works for PDF, but not Word Documents for some reason. Instead of displaying in the browser control, it opens the document in word. This is apparently something having to do with file to program association within the operating system, but I'm programming this to work on machines besides my own. Therefore, I'll either need a work around, or a way to change the setting programmatically.
Interestingly, when I right click on a doc file, click Open With, and select Internet Explorer, it opens Word.
Original Question:
I'm writing a VB program that fills in
values within a word document. I'm
utilizing the Microsoft Word 12.0
Object Library as a Reference.
I'd like to provide a scrollable preview pane to my user that is within
the form he or she is using. It
would be even cooler if the user could
edit the document through this pane.
I've done Interop extensively, so I'm
well aware of how to write and edit a
Word document. I just want to put it
into a frame and preview it. I'll
probably try to select around the
document based on what is changing as
the user provides input so they can
see what's being changed and where.
Thoughts?
Thanks
Would the print preview not do this?
Edit: Removed previous answer since it's not recommended by MS.
This article talks about using the WebBrowser control to open OFfice documents instead
http://support.microsoft.com/kb/304643/
Okay, I'm answering my own question, but leveling up those that tried to answer. I've decided that the best solution is to actually open the word document, but keep my form's TopMost property set to True. Then, I can doc my form in the upper right, display the document being edited behind it, and select around to each point being manipulated. This effectively accomplishes what I was after.
Thank you to those that provided answers here. They led me to learn quite a bit of stuff.