Highlight the differences in PDF using C# - c#

I have generated the report in PDF format that compares two .DAT files and it works fine and it highlights entire rows which have differences. But now I want to highlight specific change.
Is there anyway that compares the text from pdf and highlights the differences between it???
This is the comparison in listview
This is the comparision in pdf file which highlight entire row but now I want to highlight specific change

I think you have to try character comparison,but not directly,i have done string comparison but using the replace and to lowercase method,i.e first replace space with "",and lower the strings,then you can go for character comparison,then only result would not be weird.

Related

Spire.PDF library - filling a multiline textbox

I am using Spire.PDF for .NET to create a pdf file and I am doing the following - take the user input from a field in a webform; this input is normally a numbered list of items as shown here
In the PDF template that will be filled out by my application, there is a multiline text field that will get the text entered by the user as you see above.
Here is how that field looks in the PDF template:
Is it possible to have a number of lines in the target PDF created depending on the number of items in the numbered list entered by the user ? Like in the given example, have 3 lines, each item on its own line, like here:
This would obviously then need to move down other items/artefacts that come after in the PDF automatically (if this list gets significantly longer). Is this possible with this library?

Visual Studio Incorrectly Displays Barcode Font In RDLC Reports

I have the following issue: I have a windows form app where I print reports and they are supposed to have barcodes on them. When I am in the .rdlc file designer the barcode shows like this:
(The weird crossed out circles I assume is from the square brackets and the # symbol because data is coming from a parameter).
So when I print this out, everything prints out fine, but the thing is, the barcode font I am using is supposed to also have text underneath like this:
Now when I go into Word and type in the same barcode font (I triple checked it is the same) it behaves as expected
I looked all over the place but there are literally no posts anywhere that I could find that would help me besides this one by Microsoft It just tells me I need that .dll file but I already have it and still same results.
UPDATE: so the other report that also has barcodes works just fine, the barcodes that work are: *1868210325S0000100004* , *S00001+000001+00004+FIEG0P01* , *EDG20210325000374570*
barcode that does NOT work: *JLI-0253932*
it takes the value from a parameter "liNumber" which is populated like so:
parameters[6] = new ReportParameter("liNumber", "J" + fidelity.liNumber, true);
where fidelity.liNumber returns LI-0253932
But what I don't understand is that all working barcodes are populated in a similar fashion
Most of the times I have run into that, it was due to data. Barcode fonts may not have value for lower-case content or special characters.
I would make a copy of your report for backup, copy the detail since you have space between the detail rows. In the second instance, change the font back to a normal / simple font like Courier. Then print the report again. Check to see the ACTUAL values being printed in normal font vs your barcode font. I would bet they are upper/lower / special characters and spaces that the barcode does NOT have included in it.
Additionally, every time you run the report, write the actual values out to a text file and just keep appending text. Then, you can open the text file in Word or whatever editor, select all text, then change the font to the barcode. Do you get the same bad results.
Recreating the parameter in both .cs file like so
string jliNumber = "J" + fidelity.liNumber;
parameters[6] = new ReportParameter("liNumber", jliNumber, true);
and then in the report .rdlc file just deleting and creating the same parameter again worked for some reason

Tab Delimited Text Copy Paste To Excel

I am generating a block of text via C# Stringbuilder, with appropriately tab-delimited text (new lines, "\t", etc.) and displaying the text within a tag in my web application. If I copy/paste this to Excel, all the text pastes into the first column on the spreadsheet.
If I copy the outerHTML of the block (Chrome) or copy/paste into Notepad++ and THEN paste to Excel, all the data pastes neatly into individual cells - which is the desired outcome of this effort. Can anyone tell me what I need to do in order to be able to copy the text from my application and paste it into Excel, so that the text pastes into individual cells (ie, keeps the tab-delimited format)?
Unfortunately, it appears an extra step is required.
The default behaviour of paste in Excel (& many other applications) is to use the original format of the contents of the clipboard.
Copying from a web application/HTML page will result in the clipboard contents being flagged as HTML. The clipboard contents will have the tab character, but as HTML renders tabs to whitespace (compacting to a single whitespace if there are multiple tabs) - just using control-V will convert the tabs to spaces & the contents will appear in a single cell when pasting into Excel..
You will need to use the "Paste Special" option & select "Unicode text" to retain the tabs. There is no way to set this by default : https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_windows8-mso_365hp/how-to-change-default-paste-behavior-with-ctrl-v/f58da075-8fd5-4c80-a64b-5e71ec8ad38b?auth=1
Copying the outerHTML of Chrome sets the clipboard format to text in the first place, pasting to Notepad++ does paste as text rather than HTML then recopying sets the format to text - which is why these methods work.
I was able to paste to Excel and keep the format by changing the element my text wrote to from a div to textarea. Copy/paste of tsv from textarea to a tab-delimited Excel spreadsheet keeps the data formatted in tabular format when pasted. Thanks all for the help.
Try this ,
Before pasting data set excel's text to column delimiters to space and try to paste your values again.
Old topic but I had this. Need to copy something each day from a programme which outputs to google chrome browser. Whenever it was copied and pasted into excel it was going into 1 cell. Yet if I control all and paste it was ok.
I found you can copy only the lines you want and it will behave as wanted - if you don't drag the cursor all the way down off the page. ie if you highlight down to the last piece of information in the bottom right of screen more carefully, when you past to excel it pastes it as tab separated. Whereas if you drag it right down it pastes it all in 1 cell. Might help someone in the future who has this.
You can use 'text to columns' in Excel to format the data in the way you want it to.
After pasting the data into excel, select the column with your data.
Go to Data - click 'Text to columns'
Choose delimited and hit next
Choose Tab and hit finish.
If you don't want to use this extra step, the following works for Excel 2013:
Go to Home, Paste options and click 'Use text import wizard'
Choose delimited and hit next
Choose Tab and hit finish.

Import Txt file to access database

i have a txt file with format
10000025|246|31032017|00|0|0.00|0.00|0.00|0.00|0|0.00|0.00|0.00|0.00|0.00|0.00|0.00|R
10000025|246|31032017|01|0|0.00|0.00|0.00|0.00|0|0.00|0.00|0.00|0.00|0.00|0.00|0.00|R
10000025|246|31032017|02|0|0.00|0.00|0.00|0.00|0|0.00|0.00|0.00|0.00|0.00|0.00|0.00|R
10000025|246|31032017|03|0|0.00|0.00|0.00|0.00|0|0.00|0.00|0.00|0.00|0.00|0.00|0.00|R
i want import to access database using C# code
If someone has a clue about how to perform something like this, i would be grateful !
I dont think there is any need to use c# sort of thing in this scenario. You can accomplish this task by using an excel sheet. Copy the whole txt file and paste it into the excel sheet, once done Select the header of the cell in which you copied the text (Lets say 'A'). Now in the top menu navigate to Data Tab and select "Text to Columns". A dialogue will appear where you can select Delimited (which is default selection) and click next there you will find the delimiters section where you can specify your delimiter like comma, semi colon, etc. In your case the separator is pipe character '|' so you can specify the pipe character in a text box given in the delimiter list.
Once done click next and finish you will get the data in a column and row form exactly what you were looking for now you can import the data to sql, access or to what ever you want take a look at this Link to know how to import data from excel to access
I am attaching following screen shots
Picture of text data being copied in excelwith header selected
Screen shot of delimiter screen where you will specify the pipe character

RDLC exported to excel to show negative numbers in parentheses

I have an rdlc file with cells showing decimals.
How do I convert a negative number to have parenthesis?
I can't display it as a string, because when the report is exported it treats in as a string and throws an error that the number could not convert a string.
I've tried adding #,0:c0 for the format property but this didn't work.
Any suggestions?
Try to not use the Format function in the Expression of your Placeholder, instead in the text box (or cell) properties, you can set the type and the format of it.
In the properties, there is a section called Number in which you specify that the textbox must contains numbers of a specificated category.
Here is an image to explain:
As you can see, there is an option to set how to display negative numbers (the one selected).
Now, I'm sure that this will works if you export the report in PDF but I hope this will be the same for Excel's export
I worked it out, sorry to answer my own question.
if I use the following in the format property #,0;(-#,0) it works fine.
In my case below custom expression solved my problem.
''#,0.00;''(#,0.00);

Categories