Filter text copied from PDF - sql-server

I'm having a problem while copying text from a pdf to MS SQL Server. This pdf contains a query, which I'd like to copy to my MS SQL Server but when I do this he copies the text including some invisible symbols.
Here the first part of the query, copied from my PDF viewer:
IF​O​BJECT_ID​(​'​trgAantalIU',​'​TR')​​I​S​N​OT​N​ULL
D​ROP​T​RIGGER​trgAantalIU;​ GO
CREATE​T​RIGGER​trgAantalIUO​N​bezettingsregel AFTER​U​PDATE
AS
BEGIN
When I view this copied query in SQL Server it doesn't get the correct syntax highlighting and I discovered that there is an invisible symbol between the 'B' and the 'E' (it requires two backspaces to delete the B while the cursor was in front of the 'E', is why I know this).
My question is: how can I delete those invisible symbols? I cant find an option in MS SQL Server to do this for me.
I'm using OS X 10.11, and the included 'preview' app as pdf-viewer. MS SQL is running in a VM (Parallels Desktop, latest version).

There are a few things you can do to remove all the weird characters.
By far the easiest way to get rid of all these invisible characters is by using another application to paste text into without the actual formatting.
On Mac OS X you can use any text editor and paste the copied part into it with Shift-Option-Cmd + v to remove formatting.
If you are on windows you can copy/paste the code into notepad and it will lose all it's formatting (same thing works with mousepad, or leafpad) under Linux.
For Windows there is also an application which you can use known as "PureText".
A short description about puretext:
PureText only removes rich formatting from text. This includes the font face, font style (bold, italics, etc.), font color, paragraph styles (left/right/center aligned), margins, character spacing, bullets, subscript, superscript, tables, charts, pictures, embedded objects, etc. However, it does not modify the actual text. It will not remove or fix new-lines, carriage returns, tabs, or other white-space. It will not fix word-wrap or clean up your paragraphs. If you copy the source code of a web page to the clipboard, it is not going to remove all the HTML tags. If you copy text from an actual web page (not the source of the page), it will remove the formatting.

Related

How to format HTML in .csv for import into Enhance Dynamic Content - SFMC

with Enhanced Dynamic Content - you have to upload a .csv file and each column will turn into an EDC Map Content Block. I then create the email and drag in the Enhanced Dynamic Content Block. Each cell has to contain the proper HTML formatting as you cannot do that once it's been uploaded. I can get everything to work except muli-line text - or text with line breaks in it. I'm not sure if I'm formatting the HTML incorrectly - or if EDC does not support line breaks. In which case I would have to create a copy column for each paragraph - and that does not sound right.
Too much. I've tried adding between sentences. I've tried inserting line breaks in an Excel version of the document - then saving as .csv - this is supposed to insert some double quotes somewhere but does not.
"""""At The Hanover, we’re excited to make our latest move into the state of %%BillingState%%.
As a New England-based company with national reach, we value local, independent agents and all you do to help ensure your customers have the right protections in place.
We look forward to launching our personal lines products and services in %%BillingState%% in partnership with select independent agents."""""
The custom text for the cell above does not display - rather it displays one line text from the default row.
I ran into the same issue.
What I found worked in my instance was to add <p> Your text </P>, so that when you import it, it should respect the line breaks.

format document WebPage via Windows Forms Application?

So, I'm building a windows forms application that uses a StreamReader/StreamWriter to read each line of the .aspx, .ascx and .master pages on our asp.net website. It then removes certain properties and such from the controls through string manipulation, and writes the result back (overriding the page's markup with the edited markup). The problem is some of these pages are being written as one continuous line.
I've been unable to find anyway to call the visual studios 'Format Document' function. I found this question that would likely accomplish my goal if I weren't trying to do this from my Windows Form Application (as it's an automated process).
Any tips or points in the right direction would be appreciated.
A quick-and-dirty-solution would be (and I don't recommend it):
content = content.Replace("></", ">></").Replace("><", ">\n\t<").Replace(">></", "></");
content is the string that holds the web content.
First and last replacements are to avoid the second replacement to add newlines between something like this <tag></tag>. The above code of course has some flaws. Something like <tag1><tag2 /></tag1> will not be formatted correctly. You could avoid this by pre-replacing /></ with something you can safely re-replace at the end.
You may also want to replace \n with \r\n perhaps.

Can you concatenate RTF in a Crystal Reports formula Field

I'm currently building an application that generates a separate letter for each user in the dataset. The letter contents are managed through a vb.net application and their RTF format saved to a database. When the letter is created, all the content is pulled from the database to form the letter using vb.net logic.
Once compiled it was sent as a parameter to Crystal. This worked great, setting the field text interpretation to RTF allowed proper RTF viewing.
The client has decided that they would instead like to make changes to the logic (if statements that compile the text) within Crystal.
So what I did was create a blank dataset with a bunch of columns and filled those columns with the RTF (Ordered by ID so the values will never change unless a paragraph is deleted and there is no option for this). This would allow me to build an RTF string by going {table.1} + {table.2} etc...
This is where the problem is. When building an RTF string in a Formula (Using + or &) it only displays the first RTF entry. If I switch the formula to no interpretation, I can see the RTF for the entries written out with all their content so I know it’s there. I also manually combined the RTF in the formula field and had the same issue.
StringVar output;
output := output & "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\lang1033\f0\fs23 this is a first test }";
output := output & "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Times New Roman;}}\viewkind4\uc1\pard\lang1033\f0\fs23 this is a second test \par\par}";
Output
At this point I am unsure if there is a way around this other than moving all the text to separate Formula fields within crystal itself and then combine. This would mean if they wanted to change text it would have to be done within crystal. I would rather not go this route so I’m looking for opinions and suggestions.
Crystal does support RTF however it needs to be fully formed within the first occurance of an RTF entry. In my question it shows two separate COMPLETE RTF entries. As the entries all have the RTF ID tags this will not be possible. The same issue would occur if you copied the above text into a text editor and saved it as RTF. You would only get the first line. This doesnt explain why it works as a parameter and not a formula but its likely how each are evaluated and the later (parameter could loose support in the future).
To Properly pass RTF to crystal you will need to two Rich text box objects. One being a temp box and the other being the builder box and only selecting the formatted text, not the entire RTF content. An example of this can be found at:
http://moneybaron.org/2011/08/23/vb-net-merge-rtf-documents/
Aside from some hacks such as removing the closing brace from the RTF string or rebuilding the RTF table are also avaliable however removing the brace could lead to an unsupported configuration and rebuilding can get messy really quick.
Hope this helps!!

Exporting SSRS reports to PDF when they contain Wingdings with char value above 127

In Report Builder 2008 I use code such as
=Chr(224)
in textbox expressions to get Wingdings chars such as the up, down, straight arrows, etc. I run the report and it looks fab on screen, as well as exported to Excel.
But if I export to PDF, I've noticed any Wingdings with character values above 127 do not display inside the PDF correctly (just an empty little box.) Inside Acrobat, I go to File-Properties, look at the Fonts tab and I see that Wingdings is successfully embedded, but the encoding is set to ANSI. (If I export a document from OpenOffice using their excellent PDF export feature, the encoding says "Built in" and the Wingdings characters all look great.)
Wingdings under Chr(127) look fine on the SSRS reports. Any idea if I can do anything about the higher chars?
Thanks,
Bill
Workaround:
I wanted to use an empty square and a square with a tickbox in it.
Originally I was using windings characters 254 and 168.
Basically try to use characters below 128, and don't forget that there's wingdings 2, 3 and webdings. I found Wingdings 2 characters 82 and Wingdings 111 would work instead.
Also, you can mix and match multiple fonts by setting an expression for the font property of your expression.
Note for others: If your looking for a basic tick for your document you can switch to WebDings and use a lower case "a". This exports to PDF correctly as a tick.
I got an answer over at the official Sql Server Reporting Service forum.
The long and short of it: it's a bug. I'll be filing an issue as Andre Milbrandt suggested.
I faced the same issue with Chinese locale. Then i fixed that issue by installing Chinese language on server (where SQL reporting services are running).
Also same issue fixed by installing SQL CU6 update (without installing language pack). Here is the link for that update http://support.microsoft.com/kb/2489376

Macros in SQL Server Management Studio

Is there any way to implement text editing macros in SSMS? I would, e.g. like to convert the the code as shown below, but with a key-press, not a long-winded regex search and replace.
This:
INSERT INTO [TABLE]
([fieldOne]
,[fieldTwo])
VALUES
(<fieldOne, datetime,>
,<fieldTwo, real(24,0))
Must become this:
INSERT INTO [TABLE]
([fieldOne]
,[fieldTwo])
VALUES
(#fieldOne
,#fieldTwo)
I know SSMS doesn't natively support this, but I also know that it is extensible, if undocumented, and there is also room for a totally external application that will take copied text, transform it, and paste it back, without having to open an editor, paste, edit, copy, and paste back to SSMS.
Editing the stored templates is not an option, as these templates are dynamically generated, and using Ctrl+Shift+M is not an option either, as I still have to type each parameter name, but without the convenience of copying and pasting in the query editor.
There is no SSMS solution! I am looking for some sort of external voodoo that can help me do this.
What about an AutoHotKey script?
Depending on the complexity of your templates, you could either
use AutoHotKey to play back the keystrokes
needed for the regex search and
replace, or
copy the template to
the clipboard and manipulate it
directly within AutoHotKey before
pasting it back.
I'm sure the first option will work. I've not tried the second.
This question gives an indication of how an AutoHotKey script can be written to listen for keyboard chords.
If you are using SSMS 2005 upwards it has in built support for templates. It isn't exactly full blown macro's, but non the less it is still pretty useful.
The syntax is exactly as you have shown in your first code snippet and you simply press Ctrl+Shift+M to bring up a dialog box that prompts you for the values to go into your bits enclosed in angle brackets.
SQL server generates script in this format if you right click on a table and select "Script Table as" then pick either the insert, update or delete option.
You can also create your own custom templates, or modify one of the existing built in ones (click on View -> Template explorer to get access to the other inbuilt templates).
There is a short article on MSDN that explains how to get started with templates.
Was looking for something else, but found this question. If you're still looking for something, try SSMS toolpack: http://www.ssmstoolspack.com/ It has macros and a bunch of other neat things. And it's free!
For SSMS 2016 you can use my Visual Commander extension. It supports macros recording/playback and custom C#/VB commands for editor text manipulations.
First code is template from old-good MS Query Analyzer. Shortcut to filling is Ctrl+M (but I'm not sure, maybe it is Ctrl+Shift+M).
There should be same feature in newer SSMS.
I usually copy the code into another editor (Notepad++, or Delphi /RAD Studio editor), do my macro stuff, and then paste it back into SSMS.

Resources