Telerik Forums
Community Forums Forum
1 answer
5 views

I am currently experiencing an I/O exception when trying to export the RadDocument to a byte array using the Telerik.Windows.Documents.FormatProviders.Pdf.PdfFormatProvider.

Here is a code snippet of how am I using the Provider:

PdfFormatProvider pdfProvider = new PdfFormatProvider();

_printReportByteArray = pdfProvider.Export(_printReportDocument);

using (var memoryStream = new MemoryStream(_printReportByteArray))
{
    this.PrintReportViewer.DocumentSource = new PdfDocumentSource(memoryStream);
}

The exception occurs at

pdfProvider.Export(_printReportDocument)

It appears that the provider is trying to load the font file from the Windows directory, but for some reason this particular file is causing the exception randomly on certain machines (not on all machines). I would like to know if there is a way to resolve this issue. Like loading the font file into the memory instead of relying on the Windows directory.

Note: the font file does exist at the provided path location, and is not missing.

Here is the full exception message:

System.IO.IOException: I/O error occurred while opening the file "C:\WINDOWS\FONTS\MSYH.TTC".
   at MS.Internal.FontCache.FileMapping.OpenFile(String fileName)
   at MS.Internal.FontCache.FontSource.GetUnmanagedStream()
   at System.Windows.Media.GlyphTypeface.ComputeSubset(ICollection`1 glyphs)
   at Telerik.Windows.Documents.FormatProviders.Pdf.Fonts.GlyphMappings.ComputeSubset(PdfFontKey key, ICollection`1 glyphs)
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfFontFile2.CreateFileFontFile()
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfFontFile2.WriteContents(PdfWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfStream.WriteToCore(PdfWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfObject.WriteTo(PdfWriter writer)
   at Telerik.Windows.Documents.FormatProviders.Pdf.RadPdf.PdfWriter.WritePdfObject(PdfObject obj)
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfDocumentExporter.Export()
   at Telerik.Windows.Documents.FormatProviders.Pdf.PdfFormatProvider.Export(RadDocument document, Stream output)
   at Telerik.Windows.Documents.FormatProviders.DocumentFormatProviderBase.Export(RadDocument document)
   at Cairful.Desktop.Module.Care.NursingReports.NursingReports.Dialogs.PrintReportsDialogVM.PrintReportDocument()
   at Cairful.Desktop.Module.Care.NursingReports.NursingReports.Dialogs.PrintReportsDialog.PrintReportsDialog_OnLoaded(Object sender, RoutedEventArgs e)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)


Dess | Tech Support Engineer, Principal
Telerik team
 answered on 04 Mar 2024
0 answers
10 views

I have a TelerikEditor and I have also a List-View, I want to insert in the TelerikEditor what is selected from List-View, similar to the Knedu-ui Editor. Is there any way to do this?

 

https://demos.telerik.com/kendo-ui/editor/snippets?_ga=2.185885487.768973806.1708748600-1556274050.1704398428&_gac=1.79606246.1707819915.Cj0KCQiAw6yuBhDrARIsACf94RW6QB0GISn8O6M41zw6097jzfLc0Pa7m07eijHkyh0eA-nEwbj6dVEaAr5LEALw_wcB&_gl=1*55bc3c*_ga*MTU1NjI3NDA1MC4xNzA0Mzk4NDI4*_ga_9JSNBCSF54*MTcwODc0ODU5OS4yNS4xLjE3MDg3OTQzNzUuMS4wLjA.*_gcl_aw*R0NMLjE3MDc4MTk5MTUuQ2owS0NRaUF3Nnl1QmhEckFSSXNBQ2Y5NFJXNlFCMEdJU244TzZNNDF6dzYwOTdqemZMYzBQYTdtMDdlaWpIa3loMGVBLW5Fd2JqNmRWRWFBcjVMRUFMd193Y0I.*_gcl_dc*R0NMLjE3MDc4MTk5MTUuQ2owS0NRaUF3Nnl1QmhEckFSSXNBQ2Y5NFJXNlFCMEdJU244TzZNNDF6dzYwOTdqemZMYzBQYTdtMDdlaWpIa3loMGVBLW5Fd2JqNmRWRWFBcjVMRUFMd193Y0I.*_gcl_au*MjAxMzkxMjIyNi4xNzA0Mzk4NDI3

Sua
Top achievements
Rank 1
 asked on 24 Feb 2024
0 answers
6 views
I m using kendo-treelist-checkbox-column component, can i  display this conditionally?.....i dont want to enable the check boxes for particular rows in treelist...is this possible ??
Kavin
Top achievements
Rank 1
 asked on 12 Feb 2024
8 answers
176 views
1 answer
19 views

Hi ,

We are evaluating Telerik Reporting for our .NET 8 ERP application.

Could you please provide Win UI3 Example with Binding ObjectDataSource where Report is embedded in to the winui3 sample and bind local dto object and render also locally .

We tried from our end but  unable to use  binding ObjectDataSource.

We have attached sample for your reference.

 

 

Todor
Telerik team
 answered on 10 Jan 2024
0 answers
19 views
I want to convert a numeric to string using = CStr(Sum(Fields.CURYEXTCOST).  Example: $123,000 ->  one Hundred and twenty three thousand. 
George
Top achievements
Rank 1
 asked on 08 Jan 2024
1 answer
33 views
Here's my current code, where on the button clicks I'm opening a popup in which the user can type anything and insert it into the cursor position, it's working fine.

Problem:- When I save my text like this <p>I’m looking for the parsing to keep my deeply nested div structure but the deepest div allows inline content. For some reason, a new div gets injected though. Which I’m later removing. I’d rather not have that hack though. My name is&nbsp;<span contenteditable="false" class="uneditable" style="user-select: none; opacity: 0.5; background-color: red; padding: 2px;" id="12312381829919">rahul</span>.</p>
where rahul is a custom value inserted using a popup with properties like id & style 

but when I parse this value onMount from API, the editor doesn't keep my style and id properties and when inspected the text in the editor looks like 

<p>I’m looking for the parsing to keep my deeply nested div structure but the deepest div allows inline content. For some reason, a new div gets injected though, which I’m later removing. I’d rather not have that hack though. My name is&nbsp;<span contenteditable="false" class="uneditable" >rahul</span>.</p>

which Is without ID and style tag 

here's my code for reference 

import React, { useRef, useState } from "react";
import { Editor, EditorTools, EditorUtils, ProseMirror } from "@progress/kendo-react-editor";
import "@progress/kendo-theme-default/dist/all.css";
import { Button } from "@progress/kendo-react-buttons";
import { Dialog, DialogActionsBar } from "@progress/kendo-react-dialogs";
import { Input } from "components/atoms/input/Input";

export default function KendoEditor({ type, updateData, initalVal }) {
  const [isDialogVisible, setDialogVisible] = useState(false);
  const [customData, setCustomData] = useState("");
  const [value, setValue] = useState("test");
  var initialValue =
    type === "header" || type === "footer" ? initalVal?.data?.content : initalVal?.content;
  const editorRef = useRef(null);
  const {
    Bold,
    Italic,
    Underline,
    Strikethrough,
    Subscript,
    Superscript,
    ForeColor,
    BackColor,
    CleanFormatting,
    AlignLeft,
    AlignCenter,
    AlignRight,
    AlignJustify,
    Indent,
    Outdent,
    OrderedList,
    UnorderedList,
    NumberedList,
    BulletedList,
    Undo,
    Redo,
    FontSize,
    FontName,
    FormatBlock,
    Link,
    Unlink,
    InsertImage,
    ViewHtml,
    InsertTable,
    InsertFile,
    SelectAll,
    Print,
    Pdf,
    TableProperties,
    TableCellProperties,
    AddRowBefore,
    AddRowAfter,
    AddColumnBefore,
    AddColumnAfter,
    DeleteRow,
    DeleteColumn,
    DeleteTable,
    MergeCells,
    SplitCell,
  } = EditorTools;
  const { Schema, EditorView, EditorState } = ProseMirror;
  const nonEditable = {
    name: "nonEditable",
    inline: true,
    group: "inline",
    content: "inline+",
    marks: "",
    attrs: {
      contenteditable: { default: null },
      class: { default: null },
      style: { default: null },
      id: { default: null },
    },
    atom: true,
    parseDOM: [{ tag: "span.uneditable", priority: 51 }],
    toDOM: (node) => [
      "span",
      {
        contenteditable: false,
        class: "uneditable",
        style:
          "user-select: none; opacity: 0.5; background-color: red;text-weight:600;padding:2px;",
        id: node.attrs.id,
      },
      0,
    ],
  };

  const toggleSidebar = (type, props) => {
    return (
      <Button
        onClick={() => {
          setDialogVisible(true);
          //  setActiveProperties(type);
        }}
        onMouseDown={(e) => e.preventDefault()}
        onPointerDown={(e) => e.preventDefault()}
        title="Insert Custom Data"
        imageUrl="https://demos.telerik.com/kendo-ui/content/shared/icons/sports/snowboarding.png"
        imageAlt="KendoReact Buttons Snowboarding icon"
      />
    );
  };

  const handleInsertCustomData = () => {
    const { view } = editorRef.current;
    const schema = view.state.schema;

    // get the new node from the schema
    const nodeType = schema.nodes.nonEditable;

    // create a new node with the custom data
    const node = nodeType.createAndFill(
      {
        class: "uneditable", // Keep the existing classes
        style: "user-select: none; opacity: 0.5; background-color: red;", // Add red background color
        id: "nernksf", // Add unique ID using new Date()
      },
      schema.text(customData)
    );

    // Insert the new node
    EditorUtils.insertNode(view, node);
    view.focus();

    // Close the dialog
    setDialogVisible(false);
    setCustomData("");
  };
  console.log(initialValue);
  const onMount = (event) => {
    const { viewProps } = event;
    const { plugins, schema } = viewProps.state;

    let nodes = schema.spec.nodes.addToEnd("nonEditable", nonEditable);

    const mySchema = new Schema({ nodes: nodes, marks: schema.spec.marks });

    console.log(type, initialValue);
    const doc = EditorUtils.createDocument(mySchema, initialValue ? initialValue : "");

    return new EditorView(
      { mount: event.dom },
      {
        ...event.viewProps,
        state: EditorState.create({ doc, plugins }),
      }
    );
  };
  //console.log(value);
  const handleEditorChange = (event) => {
    const data = event?.html;
    //console.log(data);
    setValue(data);
    if (type === "header" || type === "footer") {
      updateData({ visible: initalVal?.visible, data: { ...initalVal?.data, data } });
    } else {
      updateData({ ...initalVal, data });
    }
  };
  return (
    <div>
      <Editor
        ref={editorRef}
        onMount={onMount}
        onChange={handleEditorChange}
        tools={[
          [Bold, Italic, Underline, Strikethrough],
          [Subscript, Superscript],
          ForeColor,
          BackColor,
          [CleanFormatting],
          [AlignLeft, AlignCenter, AlignRight, AlignJustify],
          [Indent, Outdent],
          [OrderedList, UnorderedList],
          [NumberedList, BulletedList],
          FontSize,
          FontName,
          FormatBlock,
          [SelectAll],
          [Undo, Redo],
          [Link, Unlink, InsertImage, ViewHtml],
          [InsertTable, TableProperties, TableCellProperties],
          [AddRowBefore, AddRowAfter, AddColumnBefore, AddColumnAfter],
          [DeleteRow, DeleteColumn, DeleteTable],
          [MergeCells, SplitCell],
          [
            (props) => toggleSidebar("dataSourceProperties", props),
            (props) => toggleSidebar("formulaProperties", props),
            (props) => toggleSidebar("letterProperties", props),
            (props) => toggleSidebar("conditionBuilder", props),
          ],
        ]}
        contentStyle={{
          height: 320,
        }}
        //value={initialValue}
      />
      {isDialogVisible && (
        <Dialog
          title="Insert Custom Data"
          onClose={() => setDialogVisible(false)}
          visible={isDialogVisible}
        >
          <div>
            <Input
              type="text"
              value={customData}
              onChange={(e) => setCustomData(e.target.value)}
              label="Enter name"
            />

            <DialogActionsBar>
              <button
                className="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
                onClick={() => setDialogVisible(false)}
              >
                No
              </button>
              <button
                className="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base"
                onClick={handleInsertCustomData}
              >
                Yes
              </button>
            </DialogActionsBar>
          </div>
        </Dialog>
      )}
    </div>
  );
}

1 answer
16 views

As show in the screenshot the output is "1 of 0" in the pagination section of the telerik grid when Data is null or empty meaning no records available. 

 

I tried to make it 0 while its running but couldn't as the input field is allowing value > 0 only, I guess. Is there an easy or quick solution for this?

Or may be I am doing something wrong. below is my code.



@* Set initial page index, and keep it updated with the grid state to prevent it from resetting the grid page index on re-renders *@

<TelerikGrid Data="@MyData" Pageable="true" @bind-PageSize="@PageSize" Height="300px"
             FilterMode="Telerik.Blazor.GridFilterMode.FilterRow" @bind-Page="@PageIndex">
      <GridSettings>
        <GridPagerSettings InputType="PagerInputType.Input"
                           PageSizes="@PageSizes"
                           ButtonCount="10"
                           Adaptive="true"
                           Position="PagerPosition.Bottom">
        </GridPagerSettings>
    </GridSettings>
    <GridColumns>
        <GridColumn Field="ID"></GridColumn>
        <GridColumn Field="TheName" Title="Employee Name"></GridColumn>
    </GridColumns>
</TelerikGrid>

@code {
    protected List<int?> PageSizes { get; set; } = null; //new List<int?> { null, 15, 30, 50 };
    int PageIndex { get; set; } = 0;
    int PageSize { get; set; } = 10;

// I have tried it with Pagechanged event as well instead of 2-way data binding but it didn't worked. 
    async Task PageChangedHandler(int currPage)
    {
        if(MyData == null || !MyData.Any())
            PageIndex = 0;
        else 
            await Task.Run(() => PageIndex = currPage);
        // when using one-way binding for the Page parametr, make sure to update it in the PageChanged event
    }

    public IEnumerable<object> MyData = Enumerable.Empty<object>(); 
        
}

1 answer
210 views

Hi,

I'm new to Telerik Web Reporting Designer (I finished implementing it today in my .NET Core project with Blazor) and realized I don't really know how to add a SQLite connection to it. The database is located in the .NET Core project folder but still doesn't work because apparently I'm missing an assembly called "System.Data.SQLite". To be honest I'm pretty lost so would appreciate a lot any kind of help. Also, I'm using Entity Framework Core.

I took one screenshot that might help you understand what's wrong:

 

https://gyazo.com/71df7aee22e405cdcdb96f0fb8adc549

 

Thanks a lot in advance.


UDPDATE: FIXED, I finally undertood the problem
Todor
Telerik team
 updated answer on 30 Nov 2023
1 answer
55 views

I want to dynamically display template.  I have one report template, but I want to able to change dynamically what should display in the template. If it is 10 columns table or 20 columns table without having to regenerate the report template.  Is there a way to programmatically control the report template content.

Todor
Telerik team
 answered on 18 Oct 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
horváth
Top achievements
Rank 2
Iron
Iron
Steve
Top achievements
Rank 2
Iron
Erkki
Top achievements
Rank 1
Iron
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Jakub
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?