I have a website where users can add comments and I am storing those comments in SQL server database. The field where I am storing the comments is nvarchar(4000). While testing I found that I had to press 'Enter' 3 times to get the desired paragraph formatting (when I view in Chrome). Usually in text editors like notepad I have to press 'Enter' 2 times to write next paragraph.
I checked in database and it looks like the text is stored as having paragraph breaks just as I want. The weird thing is that when I open my website in IE, I have no paragraph, just continuous plain text.
So, I have 2 questions:
Why do I have to press 'Enter' 3 times to get the same formatting which is similar to pressing 'Enter' 2 time in notepad?
Why is IE not having any paragraph breaks?
Thanks.
I was able to achieve this by replacing the carriage character and new line character as:
mytext.ToString().Replace("\r\n","<br/>")
Related
I'm building a database on MS Access. I have 2 text box control which are both set as long text and see formatted as plain text. When the user enters data into these fields, most of the time it's a couple of paragraphs of text, so line breaks are required to start a new paragraph. I have both fields set to go to new line after hitting the enter button. Up until I linked the data tables to SharePoint the textbox fields on the userforms and reports would show those line breaks between paragraphs just fine. Now that I have linked the database tables to SharePoint, those line breaks don't show and it's now just a text box of run on plain text. Not showing the necessary breaks between paragraphs. I checked the SharePoint table, and the field in the table shows the breaks perfectly. I then checked the field in the data table within the database and it appears those breaks aren't there. And thus those breaks won't show in the userforms when the record is called up to view in a userform and even reports.
Any advise to possibly fix this would be a big help!!! I'm at the tail end of this project and not having theses breaks between paragraphs makes things look messy.
Thanks in advance!!!
So I am creating a database and need to enter two titles into a text box. I want to type the first one, and when I am done I try to hit "enter" to jump down to the next line but all it does is save what I entered and exit the text box. What I am doing wrong? I'm so used to just hitting "enter" when I'm in Microsoft Word to start a new line but that does not seem to be how it works in Access.
Press control-enter to get a newline.
Just a tip: If you are entering two values in a single field like that, you have a badly designed table structure.
Is this text box in a table/query grid view or is it a control on a form? If it's on a form, then in design mode there is a property of the text box called Enter key behaviour that you can use to determine whether focus should jump to the next control or a new line should be entered within the text box (as you're after).
I am using MS Access 2013 to display data from a MySql database on another server. I have a table that uses the linked table. I have a textbox with about 100 words in it. When I click in the textbox the cursor can sometimes appear in the middle of a letter. If I try to add or delete text it appears offset from the position of the cursor. I have turned off auto-correct and tried changing the behavior of the enter key. How can I make the cursor behave normally?
Most probably the text contains a Tab character. The textbox doesn't show it but it messes up editing as you describe.
Copy the text into a text editor that can show invisible control characters.
My print preview from MS Access shows everything perfectly fine. Here's the actual PDF file snapshot which shows some letters are cut in half. It happens inconsistently with this report and not always for the same data.
In this report only 5 out of 40 questions had their first letter cut in half.
Please advise.
I've tried adjusting where the data field must start, i.e. I've moved the start of the question a bit more right, but no difference.
Here's the design view I've highlighted in yellow where the question starts. I've moved it more right, makes no difference.
Here's where the user captures questions]
Your problem text lines have a stray Tab character (ASCII 9) at or near the beginning of the line, which is being interpreted as a lateral positioning move for the string. Your correct lines do not have a stray Tab. If you use Acrobat's text editor to delete the Tab, the rest of the line jumps properly into view.
Below, I've extracted the text of each line in your sample, and replaced the unexpected Tab character with an "X." If you use Acrobat text editing to navigate carefully to the spot in the line where the Tab is located (you won't see it directly, but it's there), Shift-cursor sideways to highlight the Tab alone, and delete it, you'll see the text revert to its normal appearance.
Note that the Tab is usually not the first character in the line, in lines where it appears:
SXources of polyunsaturated fats include
LXack of calcium is one of the major causes of osteoporosis
XDisaccharides are the simplest form of carbohydrate
Excessive long term protein intake may lead to kidney problems
Water soluble vitamins taken in excess have toxic effects in the body
LXack of calcium is one of the major causes of osteoporosis
SXources of polyunsaturated fats include
VXitamin B12 is involved in
I'm going to hazard a guess here that the problem was introduced in the text before it was uploaded to your final document, so that the unwanted Tabs somehow snuck in as body text. I hope that helps.
That is one weird effect. It is a bit suspicious that it only occurs towards the end of the document, but I have no idea what causes it.
Two workarounds worked for me:
1) Use
=" " & [Question]
as control source of the text box, and rename it to txtQuestion to avoid a circular reference. That's two spaces, one wasn't enough.
Move it a bit to the left, to make up for the increased indentation.
2) Don't use the Access-integrated PDF creator, use a PDF printer instead.
I used the Windows 10 integrated "Microsoft Print to PDF", but there are many free ones, e.g. https://en.pdf24.org/ (just google "pdf printer driver").
This created a larger .pdf file for me, but it doesn't show the error.
Edit: Interestingly, while Adobe Acrobat Reader shows the error, Foxit Reader or the Firefox integrated PDF viewer doesn't. Here is a single page example if anyone else wants to check.
I have a database that has a field of type long text. It only allows 255 characters and if I add more then it truncates. Tried creating a new table and importing and same issue. Any ideas?
By default the Long Text (which was called Memo before Office 2013) is set to Plain Text which effectively limits the field to 255 (making it not much better than Short Text).
You have to go to the design view and change your field to Rich Text.
(taken from http://answers.microsoft.com/en-us/office/forum/office_2013_release-access/long-text-limit-254/7b927011-769f-416d-b0f7-352770270808?db=5&page=2)
Useful answer. Except if the field is full of HTML tags (which one wants to keep as tags). If one makes the field 'Rich Text' it interprets the contents and one loses the tags. A less than ideal condition.
Check the Format property of your long text field in both the database and any forms for the # character.
I removed the format character of # and everything appeared. All data over 255 characters was correctly saved in the database but subsequent views of the data only displayed the first 255 characters.
I don't like using Rich Text because it easily causes problems if you try and export the data to Excel or other formats because of the additional formatting characters in Rich Text format.
I found my solution was to set the query's Subdatasheet name to [Auto] (although after re-opening the query this field appears blank) the query now exports the long text in full. I hope this helps.
When you are in the export window, click advanced. It shows a grid of field information.
If you put your mouse over the 'Field name' heading and then move it right the cursor turns to a line with 2 arrows, move farther to the right and it turns to 2 lines with a space and 2 arrows. Click and drag right and you by magic get the skip field, go back to field name heading , do the same again and you magic the indexed, repeat and magic the width then the start and next time the data type. Ah the data type says it will be exported as a short text field, change it to long text and that is what it exports.