UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Replace Extra Line Break In Report Caused By <div> Tags, Access 2016    
 
   
snekker
post Aug 23 2019, 10:16 AM
Post#1



Posts: 117
Joined: 7-June 08



I'm surprised I've never run in to this before, but I'm using a SharePoint 2013 backend and an Access 2016 frontend to generate reports. The rich-text fields in the report are all showing an extra line break at the bottom of the field, which I now know is caused by the <div> tags pulled from the SharePoint list (enhanced rich text).

QUOTE
"Note: By default, browsers always place a line break before and after the <div> element. However, this can be changed with CSS."
https://www.w3schools.com/tags/tag_div.asp


In my report I see,
----------------------------------------------------------
This is an example of how the comments will look.
This is a new line.

----------------------------------------------------------

If I convert it to plain text, this is what I get:
<div class="ExternalClass813B783533934B93AD150B07ACB4ECDB"><p>​This is an example of how the comments will look.</p><p>This is a new line.</p></div>

Any idea how I can get rid of the extra line break at the end?
Go to the top of the page
 
theDBguy
post Aug 23 2019, 10:43 AM
Post#2


Access Wiki and Forums Moderator
Posts: 76,316
Joined: 19-June 07
From: SunnySandyEggo


Hi. Just a guess but maybe create a function to strip out the <div> tags?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
snekker
post Aug 23 2019, 11:05 AM
Post#3



Posts: 117
Joined: 7-June 08



The ExternalClass ID can change.
Go to the top of the page
 
GroverParkGeorge
post Aug 23 2019, 11:14 AM
Post#4


UA Admin
Posts: 35,683
Joined: 20-June 02
From: Newcastle, WA


That's probably why the recommendation is to create a function that can identify and remove the Div tags generically.

You'll need to find each instance of <Div and then locate the first > after that point. Because that string will be different for different Div's, that's the only way to do it. I assume that you can find the closing tag, </Div>, and remove it easily.

Do you want a hand crafting such a function?

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
theDBguy
post Aug 23 2019, 11:21 AM
Post#5


Access Wiki and Forums Moderator
Posts: 76,316
Joined: 19-June 07
From: SunnySandyEggo


Hi. You can even try using Regular Expressions. Here's one example of using it to find a group of items that can be different from each other but have the same pattern. Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
snekker
post Aug 23 2019, 02:27 PM
Post#6



Posts: 117
Joined: 7-June 08



I got it kind of working using Replace. Unfortunately as soon as you create a calculated value on a long-text field it changes it to short text and truncates it to 255 characters, which prevents it from working in the report. I moved the formula to the report and it works, but calculated fields in reports prevent filtering by those fields.
Go to the top of the page
 
theDBguy
post Aug 23 2019, 02:37 PM
Post#7


Access Wiki and Forums Moderator
Posts: 76,316
Joined: 19-June 07
From: SunnySandyEggo


Hi. Couldn't you keep the original field in the source of the report and filter by it instead? You don't have to display it anymore and use the calculated one for that.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
snekker
post Aug 27 2019, 06:28 AM
Post#8



Posts: 117
Joined: 7-June 08



I don't think so, because the user has to select the field for the filter icon to appear.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    20th September 2019 - 01:38 PM