Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Private
  • Views: 37
  • Last Modified:

Align text in rich text format in access 2010

I have a rich text field and have a bullet point which indents the text on the first line but the second line is in wrap text so the first word is under the bullet point instead of the text of the first line.  How do you align text in rich text?
0
mtrussell
Asked:
mtrussell
  • 16
  • 12
  • 2
1 Solution
 
IrogSintaCommented:
Unfortunately the capabilities of RTF in Access are somewhat limited and Hanging Indents fall into one of those limitations.  There are workarounds but each has disadvantages:

1) manually insert spaces at the beginning of each wrap around.  
- disadvantage: has to be manually done and editing the text can cause the spaces to be moved as well.

2) embed or link to a Word Document OLE object using the Unbound Frame Object control.
- disadvantage: difficult to incorporate fields from your recordsource.

3) use 3rd party ActiveX control such as Total Access Memo
- disadvantage: it's not cheap

There may be other alternatives, Lebans RTF Memo for instance, but I'm not sure if his supports anything past 2003 or does hanging indents.  Other experts may hopefully have other ideas.

Ron
0
 
Dale FyeCommented:
Access has very limited formatting capability for Rich Text fields.

I have seen comments elsewhere that creating the text in a word processor, with hanging indents and then pasting into your table might work, but I was never able to get this functionality to work properly.
0
 
mtrussellAuthor Commented:
I have seen these options but they don't work very well.  If I use plain text is there a work around?  This seems to be a pretty big limitation for an Access report.... :(
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
IrogSintaCommented:
Well, plain text will not allow bullets nor hanging indents.  If you use plain text in your report, what problem were you experiencing that you needed to use bullets?
0
 
mtrussellAuthor Commented:
This is an executive report and I have three bullet points and the report looks unprofessional with the wrapped text.  Can I link any Word references and do this using a Word control?

I have been building a database for a couple months and have executive reports that I need to use, everything looks right except for the wrapped text.  

Yeah, it looks like plain text won't work either in this.  Can I do some sort of a field length calculation and automatically and a carriage return or something?

This could be bad...
0
 
IrogSintaCommented:
The problem with field length calculation is that you have to use a fixed width font.  These fonts do not look professional so I'm sure you won't want that.  Does the text that goes here only need to be changed in design or does it have to change dynamically depending on the record?
0
 
mtrussellAuthor Commented:
dynamically.  There is a column and for each record there is text with bullet points.  All the text is descriptive so there isn't a consistent output from a programming perspective.  The structure of the field is; summary text, carriage return, bullet points.
0
 
IrogSintaCommented:
The only thing I can think of then is having a word document that uses it's mail merge feature to pull in the data from your table.  Then use the Unbound Frame Control link to this Word document.
0
 
mtrussellAuthor Commented:
but won't the fields have to be exactly the same in Word and Access for this to work?  I have never done this before.

Would any PP or Word references work in this?  It looks grim.  :(
0
 
Dale FyeCommented:
a bit more work, but you could automate Word and paste your "data" into a Word document to create your executive report.
0
 
IrogSintaCommented:
but won't the fields have to be exactly the same in Word and Access
When you set up a mail merge you will be using the actual fields from your table so yes, they will be the same.
0
 
mtrussellAuthor Commented:
Is there a tutorial on how to do this you could share?  It seems like a lot of work but it might be the only way of doing it...  also, is there any vba code that loops this automatically or am I going to have to set this up manually every time I want to print the report?
0
 
IrogSintaCommented:
You would need to repopulate a temp table each time you want a new report.  This is the table you would use in Word as your data source.  You could find tutorials on merging with Access database anywhere.  Here's one I just found:
https://www.youtube.com/watch?v=KkR_azixHZk
0
 
mtrussellAuthor Commented:
Thanks.  Here is another approach I just thought of... can I use a combination of everytime a bullet is found the Len() function is used to determine the length of the text string and then when it gets to the edge of the box it finds the previous last space it adds a left return carriage and a few spaces to make the rest of the test look like it fits?  The length of the box is 7.196cm.  Shouldn't there be a way of mathematically figuring this out?  I am not at a point in my VBA skills to do it but this seems to be doable...  

I know I am stretching here....  just was curious...
0
 
IrogSintaCommented:
Again you'd be back to using fixed width fonts like Lucinda Console or Courier New, neither of which look good in a professional document.  If you were using proportional fonts, it would be difficult to figure out where the wrap happens and the number of spaces needed to match the line above.
0
 
mtrussellAuthor Commented:
This doesn't have to be perfect.  I am fine with the right being a bit off... so if we let the code think it is using one of the two above fonts, and it rolls back and finds the first space when the text goes beyond the space of the text box, is this doable?
0
 
IrogSintaCommented:
Are you saying that you would go ahead and use either Lucida Console or Courier New?  You may want to do a test first with those fonts and see if the end result is acceptable.
0
 
IrogSintaCommented:
Also if you want to go that route, I would suggest you open another question and mention specifically that is what you'd like so that another expert could figure out the coding for that.
0
 
mtrussellAuthor Commented:
The fonts look terrible but for a fixed length perspective I would just be using it for the math.  Once the code figures out the break I can reset it back to Courier.  Wouldn't that work?
0
 
IrogSintaCommented:
No it wouldn't work.  The width of each character in proportional fonts differs so as soon as you change fonts, your formatting will be all off.
0
 
mtrussellAuthor Commented:
Let me see.  To me the code just is looking for the word that goes over the limit and then will return that word technically.  I get the font will change this but it then would technically return the previous word and the right would be off a bit.  I can control the number of spaces on the left.

I get this might not work but it is a mathematical formula more than formatting at this point... I think...

I'm reaching here... I get this...
0
 
IrogSintaCommented:
Do a quick test.  Go ahead and manually add spaces while using Courier New. Then one you have it looking right, switch the font.
0
 
mtrussellAuthor Commented:
That is the thing, I would add the spaces once I know when the word is being returned to the next line and I would add spaces for a calabri font... not the other way around...

I wouldnt align to the crap fonts.  I would technically just use the crap fonts to figure out when it crosses the textbox width and add spaces as if it was calabri and then switch the text to it....

it should work.. no idea...
0
 
IrogSintaCommented:
What I'm saying is that the word being returned to the next line will be different when you switch fonts.
0
 
IrogSintaCommented:
Here's a visual:
wrapCan you see that the words that get wrapped around are different in the above?
0
 
mtrussellAuthor Commented:
I agree with you but if it could be done as mentioned no one will care/notice if there is a space/gap in the second example if the left is aligned.  The eye trusts that if there is a space it is there for a reason.... sure in this another word could have fit but in reality no one will think anything of it.  Worst case scenario a longer word created a massive gap... in this case you would word smith things till it visually worked.  

Anyway, I know it isnt perfect.  The thing is it works in the 80/20 principle and you can work around the 20...
0
 
IrogSintaCommented:
I'm not sure you understand what I'm getting at.  If you use the sentence with the fixed fonts to figure out that you need to add spaces before the words, "once", "line", and "other" then those spaces will now be in the wrong place when you change your fonts.

Here's what I mean.  I added spaces before the words once, line, and other.  Look at the words in red.  Do you see how your spaces are not where you want them to be when you switch to a proportional font?
wrap
0
 
mtrussellAuthor Commented:
Yep, makes sense...  This is depressing... my assumption was that only one word max would be impacted not three or four...  yeah, it doesn't work... more, when the text would be wrapped it would be picking up a word with no implied spacing so it would go back underneath the bullet point...

Any ideas?  I get this isn't a report writer application but I never guessed it would be this difficult... I've gotten around many a road block on this journey...


You are a good teacher btw...
0
 
IrogSintaCommented:
Well I tried using CSS style formatting in the HTML tags of the rich textbox but it doesn't recognize CSS so throw that idea out the window.

I also tried using a Web Browser control (this can take CSS formatting) and it looked promising because it was working in a form but when I tried it on a report, the control wouldn't respond.  I also tried adding a form as a subform in the report but that had the same problem.  I thought then that you could probably make a form that looks like a report and print it but found out that the web browser control doesn't print when you print the form.

The only other idea I have is to convert the whole report to HTML, add CSS formatting, and then view it in a browser and print it from there.  I  should add that as #4 to the workarounds I listed in my first post.  Disadvantage: it's entails quite a bit of work.
0
 
IrogSintaCommented:
Just an aside...  
I just reread my earlier posts and noticed that the autocorrect on this site kept changing the spelling of Hanging Indents to Hanging Intents.  I just corrected them.
:-)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 16
  • 12
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now