Printing RTF as part of existing print job - vb.net

I have an application that uses PrintDocument to print an Invoice, and I want to print some terms and conditions type fine print on 1 portion of the invoice after all of the items, customer info, and such. I am using a richtextbox for this text since I want my user to be able to format the fine print however they wish.
However, I can't print the rtf as I do all my other text, since it just prints the rtf formatting mumbo jumbo instead of the formatted text. I am seeing examples of how to print RTF that involves printing an entire document from a file such as:
PrintDialog1.Document = rtfTextBox.rtf
, but how do I just print a portion of a page with RTF text? Is this even possible? I can't find any examples of doing this anywhere.
Maybe not necessary but here is a visual: The only RTF text is the fine print, everything else on the page will not be.
_____________________________________
| INVOICE page 1 |
| Customer: |
| John Doe |
| 123 Main St |
| |
| Items: |
| 1. Doodad 1 # $5.95 |
| 2. Widget 3 # 1.00 |
| 3 Gizmo 1 # 34.32 |
| |
| Returns must be made in 30 days |
| with original receipt. Must be in |
| original condition. |
| |
| Customer Sig: __________________ |
|____________________________________|
Note: If this isn't possible, is it possible to attach an RTF page to the end of an existing print job? Or can RTF only be printed all on its own as a standalone print job, not mixed with anything else?

Related

Not able to pass CSV file data to call another feature in background

Not able to call one feature file from another when passing the data via CSV. Same works when i directly give in examples.
The below works
Background:
def rspSes = call read('classpath:helpers/createSessionID.feature') {"customerNo": '#(IP_Customer)'}
Scenario Outline: To validate based on different product combinations
Given path '/v1/sourceAccounts'
And param paymentType = "PERSONAL"
And header cus = IP_Customer
When method get
Then status <status>
Examples:
| IP_Customer | IP_FROM_ACCT | IP_TO_ACCT | AMOUNT | Purpose | Message | status |
| 165942 | 8957 | 1004 | 5.99 | PERSONAL | dkfkdjfkdjkfjdkjfkdjfkjd | 200 |
**However, if I change the above examples to read a CSV file. It is not picking the value from CSV. Tried changing {"customerNo": <IP_Customer>}, still didnt work. **
| read("testData.csv") |

keep the extra whitespaces in display of pandas dataframe in jupyter notebook

In jupyter notebook, extra whitespaces in dataframe are removed. But sometime that is not preferred, e.g.
df=pd.DataFrame({'A':['a b','c'],'B':[1,2]})
df
The result I get:
| | A | B |
|---|-----|---|
| 0 | a b | 1 |
| 1 | c | 2 |
But I want:
| | A | B |
|---|-------|---|
| 0 | a b | 1 |
| 1 | c | 2 |
Is it possible? Thanks
It's actually HTML: pandas dutifully write all the spaces into the HTML markup (the front end format used by Jupyter Notebook). HTML, by default, collapses multiple adjacent whitespaces into one. Use the style object to change this:
df.style.set_properties(**{'white-space': 'pre'})
You unfortunately can't change the default render style of a DataFrame yet. You can write a function to wrap that line:
def print_df(df):
return df.style.set_properties(**{'white-space': 'pre'})
print_df(df)

Let pandas use 0-based row number as index when reading Excel files

I am trying to use pandas to process a series of XLS files. The code I am currently using looks like:
with pandas.ExcelFile(data_file) as xls:
data_frame = pandas.read_excel(xls, header=[0, 1], skiprows=2, index_col=None)
And the format of the XLS file looks like
+---------------------------------------------------------------------------+
| REPORT |
+---------------------------------------------------------------------------+
| Unit: 1000000 USD |
+---------------------------------------------------------------------------+
| | | | | Balance |
+ ID + Branch + Customer ID + Customer Name +--------------------------+
| | | | | Daily | Monthly | Yearly |
+--------+---------+-------------+---------------+-------+---------+--------+
| 111111 | Branch1 | 1 | Company A | 10 | 5 | 2 |
+--------+---------+-------------+---------------+-------+---------+--------+
| 222222 | Branch2 | 2 | Company B | 20 | 25 | 20 |
+--------+---------+-------------+---------------+-------+---------+--------+
| 111111 | Branch1 | 3 | Company C | 30 | 35 | 40 |
+--------+---------+-------------+---------------+-------+---------+--------+
Even I explicitly gave index_col=None, pandas still take ID column as the index. I am wondering the right way of making row numbers to be the index.
pandas currently doesn't support parsing a MultiIndex columns without also parsing a row index. Related issue here - it probably could be supported, but this gets tricky to define in a non-ambiguous way.
It's a hack, but the easiest way to work around this right now is to add a blank column on the left side of data, then read it in like this.
pd.read_excel('file.xlsx', header=[0,1], skiprows=2).reset_index(drop=True)
Edit:
If you can't / don't want to modify the files, a couple options are:
If the data has a known / common header, use pd.read_excel(..., skiprows=4, header=None) and assign the columns yourself, suggested by #ayhan.
If you need to parse the header, use pd.read_excel(..., skiprows=2, header=0), then munge the second level of labels into a MultiIndex. This will probably mess up dtypes, so you may also need to do some typecasting (pd.to_numeric) as well.

cucumber data table multiple seperate iteration

In the following feature file my requirement is to put one doc_id for every three field. To clarify, I want to check ProductName, manufacturerName and RevisionDate for every doc_id. I came up with following method but I think this is definitely not the preferred one. Can anyone suggest me a better way.
Background:
Given I am in landigpage page after login
Scenario Outline: valid
When I enter "<doc_id>"
And I click the search go button
Then I should get in vault search page
And Search result of "<field>" should match with database
Examples:
| doc_id | field |
| 15 | ProductName |
| 15 | ManufacturerName |
| 15 | RevisionDate |
Examples:
| doc_id | field |
| 16 | ProductName |
| 16 | ManufacturerName |
| 16 | RevisionDate |
You can use single examples table:
Background:
Given I am in landigpage page after login
Scenario Outline: valid
When I enter "<doc_id>"
And I click the search go button
Then I should get in vault search page
And Search result of "<field>" should match with database
Examples:
| doc_id | field |
| 15 | ProductName |
| 15 | ManufacturerName |
| 15 | RevisionDate |
| 16 | ProductName |
| 16 | ManufacturerName |
| 16 | RevisionDate |
I don't see any other way to pass arguments the way you need to. That's what I don't like about Cucumber. It is not that flexible.
Bacckground:
Given I am in landigpage page after login
Scenario Outline: valid
When I enter "<doc_id>"
And I click the search go button
Then I should get in vault search page
And the search results should match the database
Examples:
| doc_id |
| 15 |
| 16 |
and to make this work:
When /^I enter "<\w+>"$/ do | doc_id |
#doc_id = doc_id
...
end
Then "the search results should match the database" do
db_results = db.find(#doc_id) # or something similar
... # compare db_results to actual results
end
This still kind of sucks, because you have doc_id's in your Gherkin, you are relying on a prefilled database and you have a scenario outline; but hey lets save that for other questions :)
Hi i guess you guys are confusing Data Tables and scenario outline.
The solution for above is :
Background:
Given I am in landingpage page after login
Scenario Outline: valid
When I enter "<doc_id>"
And I select to navigate to search page
Then Search result of field should match with database
| ProductName |
| ManufacturerName |
| RevisionDate |
Examples:
| doc_id |
| 15 |
| 16 |
The table can easily be converted to a list or a map that you can use in your step.

ALV display one column like two

Is it possible with cl_gui_alv_grid to make two columns with the same header?
Suppose I want to display data like this :
| Tuesday | Wednesday | Thursday |
|---------------|---------------|---------------|
| Po | Delivery | Po | Delivery | Po | Delivery |
|----|----------|----|----------|----|----------|
| 7 | 245.00 | 4 | 309.00 | 12 | 774.00 |
| 4 | 105.00 | 2 | 88.00 | 3 | 160.00 |
| 10 | 760.00 | 5 | 291.00 | 20 | 1836.00 |
...
For this I think about two solutions, but I don't know if it possible.
First solution : Make two levels of field catalog, in the first one three columns, and in the second 6 columns.
Second : Make field catalog with 3 columns, and concatenate two values under each column.
Thanks.
There is a strange workaround on a german site, which deals with inheriting from alv_grid in order to override some crucial methods, to allow it, to merge cells, the source is a well known and appreciated german abap page, but, as it says, it is in german. Let us hope, any translator engine can translate this for You in a proper way, but as it looks like, this could be a step in the right direction.... but as it seems, You should fix all columns for that ( or at least those with merged cells ).
Please refer to this and tell me, if it helped:
Merge cells of alv-grid