SolvedPrivate

Align text in rich text format in access 2010

Posted on 2015-02-22
30
31 Views
Last Modified: 2016-02-11
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
Comment
Question by:mtrussell
  • 16
  • 12
  • 2
30 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624373
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
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40624375
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
 

Author Comment

by:mtrussell
ID: 40624409
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624448
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
 

Author Comment

by:mtrussell
ID: 40624456
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624465
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
 

Author Comment

by:mtrussell
ID: 40624470
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624487
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
 

Author Comment

by:mtrussell
ID: 40624495
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
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40624503
a bit more work, but you could automate Word and paste your "data" into a Word document to create your executive report.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624509
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
 

Author Comment

by:mtrussell
ID: 40624532
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624558
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
 

Author Comment

by:mtrussell
ID: 40624641
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624654
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:mtrussell
ID: 40624671
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
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 40624677
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624684
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
 

Author Comment

by:mtrussell
ID: 40624685
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624691
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
 

Author Comment

by:mtrussell
ID: 40624711
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624719
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
 

Author Comment

by:mtrussell
ID: 40624730
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624736
What I'm saying is that the word being returned to the next line will be different when you switch fonts.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40624764
Here's a visual:
wrapCan you see that the words that get wrapped around are different in the above?
0
 

Author Comment

by:mtrussell
ID: 40626841
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40627499
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
 

Author Comment

by:mtrussell
ID: 40627905
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40628153
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
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40628171
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now