FAQ Database Discussion Community

## Trying to copy Formatting in all cells from one Excell sheet into another specifically keeping fill and text color using VBA

excel,excel-vba,formatting,copy-paste
I have a working VBA script that copies exactly what I need except formatting. I at least need it to copy Fill and Text color. Here is my current code. Private Sub Workbook_Open() Application.DisplayAlerts = False Cells.Select Range("A1").Activate Selection.ClearContents Selection.UnMerge Selection.ClearContents Range("A1").Select Workbooks.Open Filename:= _ "Photo\Studio\\DAILY_REPORT_BACKUPS\DIGI_Review_Terry.xlsm" Range("A1:XFD70").Select Range("A1:XFD70").Activate Selection.Copy ActiveWindow.Close...

## Unfamiliar Javascript syntax/hack

html,formatting,script-tag,hacking
I'm perusing some source, and I see this <script type="text/javascript" src="script/jquery/jquery.1.7.1.js">//]]> </script> <script type="text/javascript" src="script/swfobject_modified.js">//]]> </script> There's a dozen or so dependencies in the head listed in such a fashion, what is the purpose of the //]]> after each script tag? The code looks a bit old school, and is...

## CSS table cell inputs not taking full width

html,css,formatting
I have a snippet in my project that involves laying out a grid for a form using CSS tables. However, I am having trouble making it work where it does not take up the full width as I would expect. .full_width { width: 100% } .table { display: table; }...

## Use DateTime format in a class but restrict time tokens

c#,parsing,datetime,formatting
I have a peculiar problem I want to solve. I have written a MonthYear class which essentially maintains a DateTime object behind the scenes and only allows methods/properties for month and year portion of the DateTime. Everything is working fine. Now I have another requirement. I want to allow anyone...

## Selecting parameters in String.format() [duplicate]

java,formatting
This question already has an answer here: Java Equivalent to .NET's String.Format 5 answers In C# you can specify which parameter is used for a formatted string with para 2: {2}. This allows for using parameters in arbitrary places and multiple times. Is there a way to do this...

## Retaining original table formatting after a 'pagebreak'

excel,excel-vba,table,formatting,page-break
So here's the finished product, a statement of accounts with a working statement table, and an ageing analysis: Everything works great. It basically populates itself row by row with data from another table. Here is the sample code: j = 21 'First row on the statement of accounts workbook For...

## How to convert html code to a string that replaces the newlines with \n and tabs with \t

javascript,html,string,formatting,markup
Is there an easy way to convert HTML code, that is structured in a certain way, to a single string (that can then be used in a Javascript variable). The new lines and tabs in the html code need to be converted to \n and \t so that the formatting...

## Google Sheets - propagate column date formatting to new rows

The date format in the column is not propagating to new rows, whenever new rows are being added to the bottom of the sheet. The column formatting is not automatically applied - this in regards to date, currency format, alignment etc.

## why is my string not in fixed size?

java,string,formatting,string-formatting
I try to print strings with padding (table like): StringBuilder sb = new StringBuilder(); sb.append(String.format("%1$15s", "bulk name")); sb.append(String.format(" | ")); sb.append(String.format("%1$15s", "baseline")); sb.append(String.format(" | ")); sb.append(String.format("%1$15s", "current")); sb.append(String.format(" | ")); sb.append("\n"); for (int i = 0; i < baseLine.tillOneSecondBulks.size(); i++) { sb.append(String.format("%1$15s", baseLine.tillOneSecondBulks.get(i).bulkName)); sb.append(String.format(" | "));...

## Excel - Conditional Formatting using time arguments

excel,date,formatting,formula,conditional-statements
Looking to change the fill of a cell based upon the amount of time between the current date (TODAY), an entered value detailing when something was done historically and a set period from that historical date of either 6months or 1year. E.g. I have a date of 12/04/2015 entered as...

## How can I print decimal places, up-to the point there are not two repeating zeros?

java,floating-point,formatting
I would like to change the below output 5250.000000000000 5512.500000000000 5788.125000000001 6077.531250000001 6381.407812500002 6700.478203125002 7035.502113281253 7387.277218945315 7756.641079892581 8144.47313388721 To the below output. 5250.0 5512.5 5788.125 6077.53125 6381.4078125 6700.478203125 7035.50211328125 7387.277218945313 7756.641079892578 8144.473133887207 So it appears the logic I need, is to only print decimal places if there is less than...

I can't seem to find out how to format my javadoc to show to show up with links to String rather than the whole path. I've gone through several different guides with no luck. I was hoping to make it look more in line with how documents at oracle look....

## How can you use a variable name inside a Python format specifier

python,formatting
Is it possible to use a variable inside of a Python string formatting specifier? I have tried: display_width = 50 print('\n{:^display_width}'.format('some text here')) but get a ValueError: Invalid format specifier. I have also tried display_width = str(50) however, just entering print('\n{:^50}'.format('some text here')) works just fine....

## TypeError: unsupported operand type(s) for %: 'int' and 'tuple' [closed]

python,formatting,raspberry-pi
On a Raspberry Pi, I've set it up so that it's monitoring ASCII serial input from the user, which it then parses and populates a matrix with the parsed data. But when I try to do something with the data: for i in range(1,7): if matrixA[i][1]>0: print "sending DO_Fire (pin...

## Printing a dictionary without newlines?

python,dictionary,file-io,printing,formatting
I'm trying to get the formatting right on my print-out and it's trickier than it should be. My objective is to have my code read in a dictionary, turn it to a list, sort it, then print it back out a text file looking like "String" "Float" "String" "Float" "String"...

## TextField formatting (padding) issue in Titanium Android

android,formatting,textfield,titanium-mobile,titanium-android
I am facing the issue of formatting a simple textfield in Titanium Android. Problem : I am not able to view the text field input value that I enter. If I print the logs its getting entered but not visible. In some devices I get cut-off text. Below is my...

## Getting a key error while using a dict with TEMPLATE.format()

python,string,python-3.x,dictionary,formatting
At a loss on this. I'm getting a key error but I can't figure out why as the key referenced looks like it's in the dict. Any help? TEMPLATE = "{ticker:6s}:{shares:3d} x {price:8.2f} = {value:8.2f}" report = [] stock = {'ticker': 'AAPL', 'price': 128.75, 'value': 2575.0, 'shares': 20} report.append(TEMPLATE.format(stock)) This...

## new line for String.format works on console, but in not in email

java,string,email,formatting
This is what I set as property props.setProperty(EmailSender.MAIL_BODY, "This is an automated email.%nZip Path: %s\nAdditional Text: %s\nThank you."); and I use it as private String generateEmailBody(final EmailRequest diagnosticRequest) { final String bodyTemplate = getExistingProperty(MAIL_BODY); return String.format(bodyTemplate, diagnosticRequest.getZipFilePath(), diagnosticRequest.getTextFromCustomer()); } When I run test, I see on console as following Content-Type:...

## Add blank row to MySQL query results based upon change in column value

mysql,sql,formatting
If I have a typical MySQL query such as: SELECT CommentNo, CreatedDate, CreatedTime, Text FROM Comment The results will be displayed in a simple table. But is it possible to have MySQL format the output so that a blank line can be inserted into the results based upon a change...

## How to .write() two items, a zero and an iterator in Python?

python,csv,formatting,conditional-statements,writing
I may have a simple formatting question here - I would like to do something like hrOut.write('0',i) in order to add/preface a zero to 'i' which is a timestamp, but I don't know the correct syntax. My code is below. Thank you all. hrIn = open('HrsInput.csv') hrOut = open('HrsOutput.csv', 'wt')...

## How will I handle JSON key with dash/hypen in Retrofit?

android,parsing,formatting,retrofit
Below is an example response I got from the server. "request": { "authenticate-login": { "response": { "status": 1, "msg": "User Authorized!" } } } I have used Retrofit for a quite some time now and it's my first to encounter such issue....

## Wrong column filtering for date column

javascript,sorting,formatting,filtering,tablesorter
I use tablesorter to sort columns. But I found the following issue: As you can see the second row doesn't have 16. This table also have the external search field and search result equals 1 if I type 16, thus second row doesn't show. But it lools like a tablesorter...

## Is it possible to format a Textbox for currency just in ASP NET?

asp.net,textbox,formatting,currency
I have this textbox that should show currency values to 2 decimal numbers. I would like to do using the "Text" property of textboxes. Is that possible? <asp:TextBox ID="txtImponibile" runat="server" Width="120px" Enabled="False" ></asp:TextBox> Thanks....

## How to make string paragraph easier to read for source code

powershell,formatting

## Delphi 7: Formatting changes after using delete procedure

delphi,formatting,string-formatting,richedit
I was working on my text editor, which I have completed, but I still have this one problem I'm trying to solve. My problem is, that I want to delete specific symbols on the end of lines, which were created by pressing the speedbutton (button is down). So when I...

## Scala: Better way for String Formatting to PhoneNumber and using Java's MessageFormat

scala,formatting,messageformat
I'm looking for a better way to better implement the following: I have imported import java.text.MessageFormat to set the format I would like. val szphoneFrmt holds the format I would like. val szInitialString is set to the value I pulled from the database. val szWorkString breaks up the string via...

Is there a existing Haskell function which provide an engineering notation formatting (as String)? If not, I read that printf can be extended by adding an instance to PrintfArg. Do you believe this is a good solution ? By engineering notation, I mean an exponent notation whose exponent is a...

## Modifying formatters in Haskell's formatting library

I'm using Chris Done's formatting library (specifically formatting-6.0.0). I'm finding it difficult to construct a `higher order' function which maps a formatter to a list formatter, performing a custom action on the resultant list of Builders: list :: ([Builder] -> Builder) -> Format r (a -> r) -> Format r...

## Override Conditional Formatting with Worksheet_SelectionChange

excel,vba,events,formatting
I have some code in a worksheet to highlight the row of a selected cell. However, this sheet has conditional formatting which colours some of the rows. The highlighting macro does not work on the rows where the formatting condition is being met (in the sense that the colour of...

## List git branches in directory using bash with formatting

git,bash,shell,ubuntu,formatting
I wants to list git branches in a set of directories using bash. Now I just want to format the branch name differently if it's "master". In other words, if the branch is 'master' I want to display it in Blue or any other color....

## Insert Excel row using format from row below, not above

I need to insert a row into an existing Excel worksheet using C# but keep the existing formatting. The default behaviour in Excel is to use the formatting of the row above, which in some cases is what I don't want as this could be different. I am sure I...

## DateTimeFormatter auto-corrects invalid (syntactically possible) calendar date

java,parsing,date,formatting,java-time
Java DateTimeFormatter throws an exception for when you try a date that goes outside of a possible range, for example: DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy"); String dateString = "12/32/2015"; LocalDate ld = LocalDate.parse(dateString, dtf); will throw: Exception in thread "main" java.time.format.DateTimeParseException: Text '12/32/2015' could not be parsed: Invalid value for DayOfMonth...

When i save view on mariadb on debian(6) I lose comments and formatting of code. What is this feature of mariadb? How turn if off? On windows instance all comments and formats are stored. Both instances is MariaDB 10.0.17. Managed with Heidi 9.1 from Windows. Edit 1. Semi solved. LOAD_FILE...

## Python 2.7 Etree/lxml minimizing [duplicate]

python,xsd,formatting,lxml
This question already has an answer here: Close a tag with no text in lxml 3 answers Im using lxml/Etree to parse and write to XSD documents. I have the basic structure tree = ET.parse('file.xsd') # do stuff tree.write('output.xsd') But tags get minimized in some instances, for example: <Cars>...

## Simple and clean java float to string conversion

java,string,floating-point,formatting,type-conversion
This is a very simple question, but I'm amazed on how difficult it has been to answer. Even the documentation didn't give a clear and straight answer. You see, I'm simply trying to convert a simple float to a string such that the result only has one decimal digit. For...

## How to format code so while loop is triggered C

c,while-loop,formatting,boolean-logic
So I have two while loops. The outer most one does not loop back the way I want it to. I first tried: #define true 1 #define false 0 But then set it to what I did below. My problem is that when I run the program, it terminates after...

## Change font color for a row when the value is one specific value

formatting,ssrs-2008,bids
I'm trying to change the font color on complete row when a value. I found the question and answer for changing the font color on a particular cell on another post here. This was part of the other answer: =IIF(Fields!Registrations.Value <> Previous(Fields!Registrations.Value), "Black", "Blue") but it won't do what I...

## Excel formatting with Java Apache POI

java,excel,formatting,apache-poi
I have an excel file in the following format: I would like to restructure this format and have it outputted in the following format: The sections are repeating and can appear in any order but they will have either format. The 'Check' column is sometimes merged across rows as shown...

## Adding a trailing 0 to my 0.1, 0.2 values, but not to my 0.25 values

java,formatting
I have a double value that is pulled in from an external method call. When a 0.6 value comes through, I want it to be changed into 0.60, but I don't wan't to put "0" at the end of my string or else it will make my 0.65 values 0.650....

## Can this be done with formatting strings alone?

c#,.net,vb.net,formatting,string-formatting
I think I've found something that can't be done with formatting strings alone: I'm needing a string that would allow me to format a double to show no decimals and so that: Numbers are thousand separated 0 shows a dash Negative numbers are shown between parentheses 0.5 is rounded to...

## SQl query, subquery formatting issue

sql,sql-server,formatting,result
I need someone to help me with some formatting. I have tried to get this into a Row using subqueries and UNION ALL etc with no success. It would seem to be rather easy but I am just beating my head against a wall with this. The table is laid...

## Bifurcate a string, removing the middle of the string instead of end

c#,.net,string,formatting
I want something similar to this question I found lead me to this answer on another question where I tried to convert it from php to c# my attempt to convert it... failed very badly: private string trimString(string str, int maxCharacters = 16) { int textLength = str.Length; return str.Substring(maxCharacters/2,...

## Is there a specific way to input characters at the beginning of a new line?

python,string,formatting
Current I am trying to implement a way to input ">" at the beginning of each separate line in a string. An example would be: String: "Hello how are you! Python is cool!" Now that's all one big string, with a line break. But is there a function to establish...

## Reformatting Dictionary output in python

python,csv,formatting,ordereddictionary
I have an OrderedDict and I've exported it to a csv but I want it to be formatted differently. My code for reading, sorting, and making the dictionary: from collections import defaultdict, OrderedDict counts = defaultdict(lambda: {"User": 0, "Equipment": 0, "Neither": 0}) with open('sorterexample.csv', 'rb') as fh: reader = csv.reader(fh,...

## Altering XML file format in C#

c#,xml,formatting
I have a program in Visual Studio which gives the output in an XML file. It looks like so: <?xml version="1.0" encoding="utf-8"?> <leaCEDS> <district> <leaID>01</leaID> <name>Alachua</name> <organizationType>LEA</organizationType> <streetLine1>620 E University Ave</streetLine1> <city>Gainesville</city> <stateProvince>FL</stateProvince> <postalCode>326015448</postalCode> <county>Alachua</county>...

## Auto insert a standard comment header for every “newly generated java file” in eclipse

java,eclipse,formatting
I want to add some default text to every newly generated java file, so that I don't have to add it manually every time. I've set the below configuration in eclipse: But when I create a new java file, the default comment I found is blank, like this: /** *...

## Erlang: strange output formatting

xml,file,formatting,erlang,output
Windows 7 x64, Erlang-OTP 17. I wrote simple module like this: -module (somequery). -export ([fbquery/2]). fbquery(P1,P2) -> inets:start(), ssl:start(), token = "78a8shd67tyajsndweiu03hr83h19j", Encoded = {"Authorization","Basic " ++ base64:encode_to_string(lists:append([token,":",""]))}, ContentType = "application/xml", Headers = [Encoded, {"Content-Type",ContentType}], Options = [{body_format,binary}], {ok, File}=file:read_file(P1), Res = httpc:request(post, {"https://datapi.com/api/xml4-8", Headers, ContentType, File}, [], Options),...

## Python's Multiplication Function

python,formatting,multiplication,presentation
In python I found a multiplication solution very useful for the software I am writing. Problem is when using the software, user is asked a question (i.e 8x2) but it prints a command-type line (i.e 14). This is not so user friendly and I would like to display it in...

## Use formatting tags in XML

html,xml,xslt,tags,formatting
Below is the source code for XML and XSLT file, the output that I am getting is "Bold Text Italics Text" the bold and italics formatting tags are ignored. How can I adjust this code to make sure ALL tags are applied and my output text is in bold/italic? XML...

## Powershell script to send email with list of files in a folder - formatting issue

email,powershell,formatting
thank you for taking the time to look at my question. I have a Powershell script that checks for files in a folder and sends an email if any files are older than 3 hours. The only problem is, I can't seem to get the formatting right when trying to...

## Get text from Gtk3 TextView/TextBuffer with formatting tags included in Python

python,formatting,gtk3
I'm working on a Python 3 project that uses the Gtk3 TextView/TextBuffer to get a user's input, and I've got it working to where I can have the user typing in rich text and able to format it as Bold/Italic/Underline/Combination of these. However, I'm stuck on trying to figure out...

## C code doesn't show in the output zero number

c++,formatting
When I'm compiling the following source code, in the output the zero doesn't correctly show. Why? I want the output text to have the following format: 01 02 03 04 05 06 07 08 not 1 2 3 4.... How can I fix this issue? #include "stdio.h" int main(int argc,...

## Format datetime axis in highcharts?

datetime,highcharts,formatting,axis-labels
http://jsfiddle.net/LLExL/4537/ Can anyone please help with this date time axis formatting on highcharts. I want Xaxis to show month only once unless the new month begins. Like 29 April 30 1 May 2 3 4 5 Any help would be highly appreciated ...

## Proper Formatting in a listbox

vb.net,listbox,formatting
I'm trying to format my listbox so that it looks neat when its in use. I want to add dollar signs to my numbers, and left align them. Any help would be appreciated. They currently look really sloppy. Dim salesTotal As Double customerListBox.Items.Add("Customer: " & " " & "Total Sale:...

## Use XSLT to convert date time to full words

xml,date,xslt,time,formatting
I am just starting to learn XSLT and am hoping to convert some XML time and date data so that it is fully spelled out. While I have seen methods to have the date information output as words (12 to December) I don't see anything that allows be to convert...

## How to convert a Rational into a “pretty” String?

I want to display some Rational values in their decimal expansion. That is, instead of displaying 3 % 4, I would rather display 0.75. I'd like this function to be of type Int -> Rational -> String. The first Int is to specify the maximum number of decimal places, since...

## Is there analog of fmt:formatNumber in velocity like in jsp?

jsp,formatting,velocity,template-engine

## Regain an original fractional numeric value that Excel has transformed to a date value

excel,date,formatting,numeric
I have an Excel workbook that contains numeric values and some of them have been transformed by Excel auto format feature into the date values. I do not know the original numeric values and neither do I have access to the .txt version of that file. Is there a way...

## Formating data in HTTP POST request with PHP

php,http,post,data,formatting
I'm using an API which gives an example of how they want the data of the POST request I'm about to make to be formatted. This is their example: un=chris& key=xxxx& origin=plot& platform=lisp& args=[[0, 1, 2], [3, 4, 5], [1, 2, 3], [6, 6, 5]]& kwargs={"filename": "plot from api", "fileopt":...

## Populate DataGridView Column With a Double forcing to 2 Decimal Places, with Sort

vb.net,sorting,datagridview,formatting
Sorry for the weird title but I didn't know how to phrase it any better. I'm trying to populate a column on my DataGridView with a number that has 2 decimal places. To do this I'm using Dim _Size as Double = 1.2345 DataGridView1.Item(0, 0).Value = Format(_Size, "0.00") This populates...

## MySQL formatting query - Setting column Results as a Table header

mysql,table,formatting
I am trying to create a report in MySQL to output number of Traded Shares, by Client and by Market. I have got the results I want (using multiple tables), but need to change the output table so that the results from one column become the header of another, and...

## Python3 Display certain number of output

python,python-3.x,formatting,format
I have a list a numbers, I want to display 10 per line, and they have to format really nice start: 1 End: 1000 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101...

## Represent a buffer efficiently as unicode string

c++,windows,string,unicode,formatting
I have a random buffer. I need to encode it to a unicode string (utf16 LE. as used by windows wide-char specification) so it can be used as PWSTR. For example when calling to StringCchPrintfW A possible solution can be to use base64. But in order to make it a...

## How do I convert a double into an n-character string using exponential notation?

java,string,formatting,double
I have found this vise-versa many times on SO, but never like I want it. I want to convert a double into a string that takes up exactly n characters. If n is, for example, 6, then 1,000,123.456 would become 1.00E6 -1,000,123.456 would become 1.0E-6 1.2345678 would become 1.2345 1,000,000,000,000...

## Customised Style not showing in pages

c#,wpf,xaml,formatting
I've been working on this for a while and hit a hump that I cannot solve. The custom style I have works for some elements and not others. For instance, it works for the fonts, and will even format the button fonts, when I've only stipulated the TextBlock fonts. Most...

## SSRS Average Time in Minutes and then Format to HH MM

sql,stored-procedures,reporting-services,formatting
I've seen a lot of questions about average time in SSRS but I'm pretty new to this and none of these questions address my specific need so any help would be appreciated. I have a duration field (Fields!Duration1.Value) which is pulling in a duration in minutes (example: 170). In my...