copy query from sql developer with format - sql

How can I copy queries from Oracle SQL Developer with format. Unlike Toad the query format is lost as I paste it in any document.
I am referring to font formatting.

Not (yet) supported in 4.x.
Your best shot is to vote/rate it up: "Copy to clipboard" should include HTML and/or RTF clipboard formats
As a workaround, if you really, really want it bad - you might try out long and tedious path of using "Print" option in color to some PDF printer, then copying it from there (some programs like Preview on Mac OS X preserve formatting while copying from PDF)

There is an extension called "Copy As HTML/RTF". But version 4.x doesn't support extensions. Only 3.x and earlier versions support them.

if you are talking about Highlight Format, I can suggest you to use one plugin in Notepad++, which preserves the Font color as in Notepad++ when you copy to Microsoft Word.
You can visit this site: Copy Notepad++ text with formatting?

SSMS has the same issue. With SSMS, it appears that there is a 10,045 byte limit. At 10,046 char/bytes, the sql format changes to text. There are two ways to resolve this issue that I know of so far.
Select all the sql text in the query window, open the word doc, and drag the text over to word instead of copy/pasting it.
Break your copy/paste text into sections less than 10,045 bytes and paste to word code section by code section. In other words, select sections of the sql text that are smaller than 10,045 bytes and copy/paste multiple times into word instead of the whole query at once.

Related

SSRS 2008: Strange characters in PDF after exporting report to PDF

I have a set of reports created with SQL Server Business Intelligence Studio 2008.
Reports run on SSRS 2008 and exported to PDF.
In PDF files, however, some of the text cannot be found by "Find". If this text is copied from PDF and pasted into a text document, a strange combination of symbols is pasted - i.e. Copy "1400" from PDF and "1e4d0it0e" is pasted, see screenshot below.
Another strange feature: the same field, in this case "Id", is presented in two tables in the same report, and in the first case some Ids are "garbled" in PDF, but in the second all are rendered correctly. I can see no visible differences between tables.
Any ideas on how to prevent such behaviour?
I found why this is happening, even though it makes no sense to me.
Where the text is displayed properly in the PDF, the textbox has a setting CanGrow=true.
Where the text is "garbled" in PDF after Copy-Paste, the textbox has a setting CanGrow=false.
Changing the setting on the textbox fixes the issue.

Copy text from PDF with custom FONT

I am trying to copy some text from a PDF. But When I paste it in a word file, it is just some garbage. Something like മുഖവുര. The PDF is in Malayalam language. When I see File->Properties->Fonts, It says BRHMalayalam (Embedded Subset) as shown in the screenshot.
I installed various Malayalam fonts but still no luck. Can anyone please guide me?
The PDF I am trying to copy from is https://drive.google.com/open?id=0B3QCwY9Vanoza0tBdFJjd295WEE&authuser=0
Installing fonts won't help, since they are embedded in the document. The reader will use the ones in the document.
In fact it almost certainly must use the ones on the document, because it will probably have used character codes specific to each font subset.
Your PDF probably has character codes which are not Unicode values, and does not contain ToUnicode CMaps for the fonts in question (note the same font name embedded multiple times). There is no realistic way to copy the text.
The best you can do is OCR it.
After looking at the file, and confirming the answer already given by #KenS, the problem with this PDF document is in fact how it's constructed. Or rather how the font in the document has been embedded.
The document contains a number of Times and Arial fonts, for which the text can be copied successfully. Those fonts are embedded as a subset with a WinAnsi encoding. What is actually in the file is close enough to that, that the text seems to copy out well.
The problem font (BRHMalayalam) is also embedded as a subset, and its encoding is also set as WinAnsiEncoding, which completely doesn't make sense.
And because the font doesn't contain a ToUnicode mapping table, a PDF viewer has no other choice when copying and pasting to assume the characters in the PDF are indeed Win Ansi encoding which means you end up with (garbled) latin characters.
Just convert the pdf file to word file and then edit or copy or modify the text present in the file simple :)
and after completion go to file -> save as -> and change the format of doc to pdf ..hope u understood :)

MS Access VBA code editor character encoding and copy/paste

What is the actual encoding used in Access' VBA editor? I have been searching for a concrete answer for quite a while but with no luck.
I thought it was UTF-8 but I'm not very certain.
My main issue is that when writing a query in VBA I sometimes need to test it in Access' query editor. When copy-pasting however, I lose my native characters (greek in my case) as they turn to gibberish.
I have tried pasting in a text editor and saving it as different encodings but I can never recover the original characters.
Thanks in advance.
Edit
Let me explain this a bit further:
As you can see I can write my greek characters in the VBA editor normally:
However, copying the first line in Access' query editor, I get the following:
Same goes for a simple text editor:
So I am inclined to think that the problem lies inside the clipboard, due to the encoding used for the greek characters. I guess they are not Unicode, as I indeed have to make the change in the System Locale for non-unicode characters. So how are these characters saved/copied? In what encoding?
Answer
Actually this problem was solved by switching the keyboard input language to greek (EL), when copying the actual test string.
I am still not sure however, as to why that happens. If anyone can provide some insight into this, I would love to hear it.
Thanks again
The VBA editor does not support Unicode characters, either for input or display. Instead, it uses the older Windows technology called "code pages" to provide support for non-ASCII characters.
So, the character encoding in the VBA editor corresponds to the code page that is used by the Windows system locale as specified in the "Regional and Language Options" control panel. For example, with my system locale set to "Greek (Greece)"
I can enter Greek characters into my VBA code
However, if I switch my Windows system locale back to "English (United States)"
and re-open my VBA project, the Greek characters have changed to the corresponding characters in the new code page
If "Control Panel" -> "Regional and Language Options" -> "System Locale" is set correctly but you still suffer from this problem some times then note that while you're copying your keyboard layout must be switched to the non-English language.
This is applicable to all non-unicode-aware applications not only VBA.
Credit goes to #parakmiakos
details in this: http://www.pcreview.co.uk/forums/use-greek-characters-visual-basic-editor-t2097705.html
Looks like making sure your OS is set properly, and font choice inside the VBA editor.
I had a similar problem with Cyrillic characters. Part of the problem is solved when set the System locale correctly.
However, The VBA editor still does not recognize cyrillic characters when it has to interpret them from inside itself.
For example it can not display characters from the command:
Msgbox "Здравей"
but if the sheet name is in cyrillic characters it does it well:
Msgbox Activesheet.Name
Finally, it turned out that these kind of problems were solved when I changed to 32 bits version of MS Office.

How to put Objective C code into Word (Office) with syntax highlighting

I am writing documentation about an app and want to explain the code.
I want to copy parts of the Objective C code from Xcode to Microsoft Word.
I don't know how to put the code with syntax highlighting (and maybe line numbers, too ?!) into Word.
Does anybody know a usable solution for this little problem?
Copy and paste works !
Nevertheless, make sure the option "Copy colors and fonts" in Preferences>Fonts & Colors is checked !
If you need this in Pages you can paste into textedit then copy/paste from textedit into pages. I have yet to find a way to paste directly into pages and preserve the text color etc
If you copy from Xcode and paste into Word you get syntax highlighting etc as expected. You just need to reduce the font size to make it more readable and avoid wrapping etc. It would probably be a good idea to define a suitable Style in Word, e.g. "Code" which would have the required font size etc for pasted code.
It supports these by default in Xcode 4. And what you need to do is to choose "Use Orignal Format" in Word or Power Point.
If you need this in Pages, then a workaround is to copy in Xcode, paste in Word, copy again and then paste in Pages (That is if you have MS Word available).

How to Pretty print VBA code?

How do you copy VBA code into a Word document and retain the VBA editor color scheme?
You can use Notepad++ to accomplish this in three ways. Just so you know, Notepad++ is a more advanced version of Notepad, which supports syntax highlighting of different code files "out of the box" - Visual Basic included!
Download & install it, fire it up, and load up your VBA code. You should automatically see it beautifully coloured (if not, because the file extension is something other than .vb, go to Language -> VB or Language -> V -> VB).
If you need to change any of the colours, you can easily do so - just go to Settings -> Styler Configurator. From that menu, you can change the various highlighting and font options, to suit your needs - although the default usually suffices for most.
Then, go to Plugins -> NppExport. From there, you have three options you can consider:
Directly print from Notepad++
Copy all formats to clipboard
Export to RTF
Export to HTML
The first is self explanatory. The second one - "Copy all formats to clipboard" - will copy the entire file with the highlighted syntax to the clipboard. Once you click it, then open Microsoft Word or your other favourite document editor, and just hit paste! You should see the beautifully syntax-highlighted code. If something goes wrong, then you can try one of the other options (export to RTF/HTML), although I've never had a problem with the clipboard method.
There are two programs on cnet downloads, which are free to try. In case you did not try them, here are the links:
VB-VBA Code Formatter & Printer 2.2
VBAcodePrint 6.13.110
Smart Indenter could be what you're looking for? You'd load the result into Notepad++, set language to VB and save as .rtf/.doc (or print to file, can't remember off the top of my head).
For a more modern approach, Sublime Text users can install ExportHTML from Package Control. This has the added benefit of being able to include the line numbers, and changing the code coloration.
HTML files can be opened directly within Word.
Highlight supports a wide range of Operating Systems and 150+ languages including Visual Basic, although I'm not sure about VBA.
I would recommend this one: planetB
It works well with Internet Explorer (didn't work wit Firefox for me, not sure abt Chrome).
Plus it's online, so no need to install anything (the case of Company/University PC's)
Regards
Wheeliam
The following works with Visual Studio Code:
Start VS Code.
New file.
Copy & Paste the VBA code into the VS Code window.
In the lower right-hand corner, click on "Plain Text" and select "Visual Basic" instead. Note that the code is now syntax-highlighted.
Copy & Paste the formatted code into Word.